Ultimate Member – User Profile & Membership Plugin - Version 1.3.39

Version Description

Download this release

Release Info

Developer ultimatemember
Plugin Icon 128x128 Ultimate Member – User Profile & Membership Plugin
Version 1.3.39
Comparing to
See all releases

Code changes from version 1.3.38 to 1.3.39

addons/gravatar_transfer.php ADDED
@@ -0,0 +1,84 @@
1
+ <?php
2
+
3
+ class UM_ADDON_gravatar_transfer {
4
+
5
+ function __construct() {
6
+
7
+ add_action('admin_menu', array(&$this, 'admin_menu'), 1001);
8
+
9
+ add_action('admin_init', array(&$this, 'admin_init'), 1);
10
+
11
+ add_action('um_admin_addon_hook', array(&$this, 'um_admin_addon_hook') );
12
+
13
+ }
14
+
15
+ function gravatar_hash(){
16
+ global $wpdb;
17
+ $wpdb->query('DELETE FROM '.$wpdb->usermeta.' WHERE meta_key = "synced_gravatar_hashed_id" ');
18
+
19
+ $wpdb->query('INSERT INTO '.$wpdb->usermeta.'(user_id, meta_key, meta_value)
20
+ SELECT ID, "synced_gravatar_hashed_id", MD5( LOWER( TRIM(user_email) ) )
21
+ FROM '.$wpdb->users.' ');
22
+
23
+ return true;
24
+ }
25
+
26
+ function admin_menu() {
27
+
28
+ global $ultimatemember;
29
+ $this->addon = $ultimatemember->addons['gravatar_transfer'];
30
+ add_submenu_page('ultimatemember', $this->addon[0], $this->addon[0], 'manage_options', 'gravatar_transfer', array(&$this, 'content') );
31
+
32
+ }
33
+
34
+ function um_admin_addon_hook( $hook ) {
35
+ global $ultimatemember;
36
+ switch( $hook ) {
37
+ case 'gravatar_transfer':
38
+ if( $this->gravatar_hash() ){
39
+ $this->content = '<p><strong>Done. Process completed!</p>';
40
+ $result = count_users();
41
+ $this->content .= $result['total_users'] . ' user(s) changed.</strong></p>';
42
+ }
43
+ break;
44
+ }
45
+ }
46
+
47
+ function admin_init() {
48
+ if ( isset( $_REQUEST['um-addon-hook'] ) ) {
49
+ $hook = $_REQUEST['um-addon-hook'];
50
+ do_action("um_admin_addon_hook", $hook);
51
+ }
52
+ }
53
+
54
+ function content() {
55
+
56
+ $this->process_link = add_query_arg('um-addon-hook','gravatar_transfer');
57
+
58
+ ?>
59
+
60
+ <div class="wrap">
61
+
62
+ <h2>Ultimate Member <sup style="font-size:15px"><?php echo ultimatemember_version; ?></sup></h2>
63
+
64
+ <h3><?php echo $this->addon[0]; ?></h3>
65
+
66
+ <?php if ( isset( $this->content ) ) {
67
+ echo $this->content;
68
+ } else { ?>
69
+
70
+ <p>This tool allows you to add gravatars to Ultimate Member users. This can help you to link gravatar photos to user accounts with their email address.</p>
71
+ <p>Depending on your users database, this could take a few moments. To start the process, click the following button.</p>
72
+
73
+ <p><a href="<?php echo $this->process_link; ?>" class="button button-primary">Start adding gravatars</a></p>
74
+
75
+ <?php } ?>
76
+
77
+ </div><div class="clear"></div>
78
+
79
+ <?php
80
+
81
+ }
82
+ }
83
+
84
+ $UM_ADDON_gravatar_transfer = new UM_ADDON_gravatar_transfer();
admin/core/packages/1.3.39.php ADDED
@@ -0,0 +1,27 @@
1
+ <?php
2
+
3
+ // If this file is called directly, abort.
4
+ if ( ! defined( 'WPINC' ) ) {
5
+ die;
6
+ }
7
+
8
+ /**
9
+ * This populates all existing UM users with meta_key `last_login` as `user_registered` if the meta key doesn't exist.
10
+ * Target Version: 1.3.39
11
+ */
12
+
13
+ global $wpdb, $ultimatemember;
14
+ $wpdb->query('INSERT INTO '.$wpdb->usermeta.'(user_id, meta_key, meta_value)
15
+ SELECT uu.ID, "_um_last_login", uu.user_registered
16
+ FROM '.$wpdb->users.' AS uu
17
+ WHERE
18
+ uu.ID NOT IN(
19
+ SELECT user_id FROM '.$wpdb->usermeta.'
20
+ WHERE meta_key = "_um_last_login"
21
+ GROUP BY user_id
22
+ )'
23
+ );
24
+
25
+
26
+
27
+ ?>
admin/core/um-admin-roles.php CHANGED
@@ -27,7 +27,7 @@ class UM_Admin_Roles {
27
}
28
29
/***
30
- *** @Display cusom columns for Role
31
***/
32
function manage_um_role_posts_custom_column($column_name, $id) {
33
global $wpdb, $ultimatemember;
@@ -42,7 +42,7 @@ class UM_Admin_Roles {
42
$role = $post->post_name;
43
}
44
$data = $ultimatemember->query->role_data($role);
45
- if ( $data['can_access_wpadmin'] ){
46
echo '<span class="um-adm-ico um-admin-tipsy-n" title="'.__('This role can access the WordPress backend','ultimatemember').'"><i class="um-faicon-check"></i></span>';
47
} else {
48
echo __('No','ultimatemember');
27
}
28
29
/***
30
+ *** @Display custom columns for Role
31
***/
32
function manage_um_role_posts_custom_column($column_name, $id) {
33
global $wpdb, $ultimatemember;
42
$role = $post->post_name;
43
}
44
$data = $ultimatemember->query->role_data($role);
45
+ if ( isset( $data['can_access_wpadmin'] ) && $data['can_access_wpadmin'] == 1 ){
46
echo '<span class="um-adm-ico um-admin-tipsy-n" title="'.__('This role can access the WordPress backend','ultimatemember').'"><i class="um-faicon-check"></i></span>';
47
} else {
48
echo __('No','ultimatemember');
admin/core/um-admin-upgrade.php ADDED
@@ -0,0 +1,31 @@
1
+ <?php
2
+ /**
3
+ * This class handles all functions that changes data structures and moving files
4
+ */
5
+ class UM_Upgrade {
6
+
7
+ function __construct() {
8
+ $um_last_version_upgrade = get_option('um_last_version_upgrade');
9
+
10
+ if( ! $um_last_version_upgrade || $um_last_version_upgrade != ultimatemember_version ){
11
+ add_action( 'admin_init', array($this,'packages'),10);
12
+ }
13
+
14
+ }
15
+
16
+ /**
17
+ * Load packages
18
+ */
19
+ public function packages( ){
20
+
21
+ $file_path = plugin_dir_path ( __FILE__ ).'packages/'.ultimatemember_version.'.php';
22
+
23
+ if( file_exists( $file_path ) ){
24
+ include_once( $file_path );
25
+ update_option( 'um_last_version_upgrade', ultimatemember_version );
26
+ }
27
+ }
28
+
29
+ }
30
+
31
+ new UM_Upgrade();
admin/templates/directory/general.php CHANGED
@@ -34,7 +34,7 @@
34
</p><div class="um-admin-clear"></div>
35
36
<p>
37
- <label class="um-admin-half"><?php _e('Only show members who have uploaded a profile photo','ultimatemember'); ?></label>
38
<span class="um-admin-half">
39
40
<?php $this->ui_on_off('_um_has_profile_photo'); ?>
34
</p><div class="um-admin-clear"></div>
35
36
<p>
37
+ <label class="um-admin-half"><?php _e('Only show members who have uploaded a profile photo','ultimatemember'); ?><?php $this->tooltip('If \'Use Gravatars\' as profile photo is enabled, this option is ignored'); ?></label>
38
<span class="um-admin-half">
39
40
<?php $this->ui_on_off('_um_has_profile_photo'); ?>
assets/js/um-conditional.js CHANGED
@@ -1,16 +1,16 @@
1
jQuery(document).ready(function() {
2
-
3
- jQuery(document).on('input', '.um-field input[type=text]', function(){
4
-
5
live_field = jQuery(this).parents('.um-field').data('key');
6
live_value = jQuery(this).val();
7
um_conditional();
8
-
9
});
10
jQuery('.um-field input[type=text]').trigger('input');
11
-
12
jQuery(document).on('change', '.um-field select, .um-field input[type=radio], .um-field input[type=checkbox]', function(){
13
-
14
live_field = jQuery(this).parents('.um-field').data('key');
15
live_value = jQuery(this).val();
16
@@ -24,14 +24,14 @@ jQuery(document).ready(function() {
24
live_value = jQuery(this).parents('.um-field').find('input:checked').val();
25
}
26
}
27
-
28
if ( jQuery(this).is(':radio') ) {
29
live_value = jQuery(this).parents('.um-field').find('input[type=radio]:checked').val();
30
}
31
32
um_conditional();
33
-
34
});
35
jQuery('.um-field select, .um-field input[type=radio], .um-field input[type=checkbox]').trigger('change');
36
37
- });
1
jQuery(document).ready(function() {
2
+
3
+ jQuery(document).on('input change', '.um-field input[type=text]', function(){
4
+
5
live_field = jQuery(this).parents('.um-field').data('key');
6
live_value = jQuery(this).val();
7
um_conditional();
8
+
9
});
10
jQuery('.um-field input[type=text]').trigger('input');
11
+
12
jQuery(document).on('change', '.um-field select, .um-field input[type=radio], .um-field input[type=checkbox]', function(){
13
+
14
live_field = jQuery(this).parents('.um-field').data('key');
15
live_value = jQuery(this).val();
16
24
live_value = jQuery(this).parents('.um-field').find('input:checked').val();
25
}
26
}
27
+
28
if ( jQuery(this).is(':radio') ) {
29
live_value = jQuery(this).parents('.um-field').find('input[type=radio]:checked').val();
30
}
31
32
um_conditional();
33
+
34
});
35
jQuery('.um-field select, .um-field input[type=radio], .um-field input[type=checkbox]').trigger('change');
36
37
+ });
assets/js/um-crop.js CHANGED
@@ -379,11 +379,12 @@
379
380
initContainer: function () {
381
var $container = this.$container;
382
-
383
- this.container = {
384
- width: max($container.width(), 300),
385
- height: max($container.height(), 150)
386
- };
387
},
388
389
initCropper: function () {
379
380
initContainer: function () {
381
var $container = this.$container;
382
+ if($container !== NULL){
383
+ this.container = {
384
+ width: max($container.width(), 300),
385
+ height: max($container.height(), 150)
386
+ };
387
+ }
388
},
389
390
initCropper: function () {
assets/js/um.min.js CHANGED
@@ -4,4 +4,4 @@ var a=this;this.selection.on("click",".select2-search-choice:not(.select2-locked
4
var i=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)#x2F;i;return this.each(function(){var a=this.type,n=this.tagName.toLowerCase();i.test(a)||"textarea"==n?this.value="":"checkbox"==a||"radio"==a?this.checked=!1:"select"==n?this.selectedIndex=-1:"file"==a?/MSIE/.test(navigator.userAgent)?e(this).replaceWith(e(this).clone(!0)):e(this).val(""):t&&(t===!0&&/hidden/.test(a)||"string"==typeof t&&e(this).is(t))&&(this.value="")})},e.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var i=this.type;if("checkbox"==i||"radio"==i)this.checked=t;else if("option"==this.tagName.toLowerCase()){var a=e(this).parent("select");t&&a[0]&&"select-one"==a[0].type&&a.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1}),function(e){void 0==e.fn.ajaxForm;var t={};t.fileapi=void 0!==e("<input type='file'/>").get(0).files,t.formdata=void 0!==window.FormData,e.fn.uploadFile=function(i){function a(){h.afterUploadAll&&!g&&(g=!0,function e(){0!=f.sCounter&&f.sCounter+f.fCounter==f.tCounter?(h.afterUploadAll(f),g=!1):window.setTimeout(e,100)}())}function n(t,i,a){a.on("dragenter",function(t){t.stopPropagation(),t.preventDefault(),e(this).css("border","2px dashed #ddd")}),a.on("dragover",function(e){e.stopPropagation(),e.preventDefault()}),a.on("drop",function(a){e(this).css("border","2px dashed #ddd"),a.preventDefault(),t.errorLog.html("");var n=a.originalEvent.dataTransfer.files;return!i.multiple&&n.length>1?void(i.showError&&e("<div class='um-error-block'>"+i.multiDragErrorStr+"</div>").appendTo(t.errorLog)):void(0!=i.onSelect(n)&&o(i,t,n))}),e(document).on("dragenter",function(e){e.stopPropagation(),e.preventDefault()}),e(document).on("dragover",function(e){e.stopPropagation(),e.preventDefault(),a.css("border","2px dashed #ddd")}),e(document).on("drop",function(e){e.stopPropagation(),e.preventDefault(),a.css("border","2px dashed #ddd")})}function r(t){var i=[];i="string"==jQuery.type(t)?t.split("&"):e.param(t).split("&");var a,n,r=i.length,o=[];for(a=0;r>a;a++)i[a]=i[a].replace(/\+/g," "),n=i[a].split("="),o.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return o}function o(t,i,a){for(var n=0;n<a.length;n++)if(s(i,t,a[n].name))if(-1!=t.maxFileSize&&a[n].size>t.maxFileSize)t.showError&&e("<div class='um-error-block'>"+t.sizeErrorStr+"</div>").appendTo(i.errorLog);else if(-1!=t.maxFileCount&&i.selectedFiles>=t.maxFileCount)t.showError&&e("<div class='um-error-block'>"+t.maxFileCountErrorStr+"</div>").appendTo(i.errorLog);else{i.selectedFiles++;var o=t,l=new FormData,c=t.fileName.replace("[]","");l.append(c,a[n]);var h=t.formData;if(h)for(var p=r(h),f=0;f<p.length;f++)p[f]&&l.append(p[f][0],p[f][1]);o.fileData=l;var m=new u(i,t),g="";g=t.showFileCounter?i.fileCounter+t.fileCounterStyle+a[n].name:a[n].name,m.filename.html(g);var v=e("<form style='display:block; position:absolute;left: 150px;' class='"+i.formGroup+"' method='"+t.method+"' action='"+t.url+"' enctype='"+t.enctype+"'></form>");v.appendTo("body");var y=[];y.push(a[n].name),d(v,o,m,y,i),i.fileCounter++}else t.showError&&e("<div class='um-error-block'>"+t.extErrorStr+"</div>").appendTo(i.errorLog)}function s(e,t,i){var a=t.allowedTypes.toLowerCase().split(","),n=i.split(".").pop().toLowerCase();return"*"!=t.allowedTypes&&jQuery.inArray(n,a)<0?!1:!0}function l(t,i){if(t.showFileCounter){var a=e(".upload-filename").length;i.fileCounter=a+1,e(".upload-filename").each(function(i,n){var r=e(this).html().split(t.fileCounterStyle),o=(parseInt(r[0])-1,a+t.fileCounterStyle+r[1]);e(this).html(o),a--})}}function c(i,a,n,r){var h="ajax-upload-id-"+(new Date).getTime(),p=e("<form method='"+n.method+"' action='"+n.url+"' enctype='"+n.enctype+"'></form>"),f="<input type='file' id='"+h+"' name='"+n.fileName+"'/>";n.multiple&&(n.fileName.indexOf("[]")!=n.fileName.length-2&&(n.fileName+="[]"),f="<input type='file' id='"+h+"' name='"+n.fileName+"' multiple/>");var m=e(f).appendTo(p);m.change(function(){i.errorLog.html("");var h=(n.allowedTypes.toLowerCase().split(","),[]);if(this.files){for(y=0;y<this.files.length;y++)h.push(this.files[y].name);if(0==n.onSelect(this.files))return}else{var f=e(this).val(),m=[];if(h.push(f),!s(i,n,f))return void(n.showError&&e("<div class='um-error-block'>"+n.extErrorStr+"</div>").appendTo(i.errorLog));if(m.push({name:f,size:"NA"}),0==n.onSelect(m))return}if(l(n,i),r.unbind("click"),p.hide(),c(i,a,n,r),p.addClass(a),t.fileapi&&t.formdata){p.removeClass(a);var g=this.files;o(n,i,g)}else{for(var v="",y=0;y<h.length;y++)v+=n.showFileCounter?i.fileCounter+n.fileCounterStyle+h[y]+"<br>":h[y]+"<br>",i.fileCounter++;if(-1!=n.maxFileCount&&i.selectedFiles+h.length>n.maxFileCount)return void(n.showError&&e("<div class='um-error-block'>"+n.maxFileCountErrorStr+"</div>").appendTo(i.errorLog));i.selectedFiles+=h.length;var b=new u(i,n);b.filename.html(v),d(p,n,b,h,i)}}),p.css({margin:0,padding:0});var g=e(r).width()+10;10==g&&(g=120);var v=r.height()+10;10==v&&(v=35),r.css({position:"relative",overflow:"hidden",cursor:"default"}),m.css({position:"absolute",cursor:"pointer",top:"0px",width:"100%",height:"34px",left:"0px","z-index":"100",opacity:"0.0",filter:"alpha(opacity=0)","-ms-filter":"alpha(opacity=0)","-khtml-opacity":"0.0","-moz-opacity":"0.0"}),p.appendTo(r)}function u(t,i){return this.statusbar=e("<div class='upload-statusbar'></div>"),this.filename=e("<div class='upload-filename'></div>").appendTo(this.statusbar),this.progressDiv=e("<div class='upload-progress'>").appendTo(this.statusbar).hide(),this.progressbar=e("<div class='upload-bar "+t.formGroup+"'></div>").appendTo(this.progressDiv),this.abort=e("<div class='upload-red "+t.formGroup+"'>"+i.abortStr+"</div>").appendTo(this.statusbar).hide(),this.cancel=e("<div class='upload-red'>"+i.cancelStr+"</div>").appendTo(this.statusbar).hide(),this.done=e("<div class='upload-green'>"+i.doneStr+"</div>").appendTo(this.statusbar).hide(),this.del=e("<div class='upload-red'>"+i.deletelStr+"</div>").appendTo(this.statusbar).hide(),t.errorLog.after(this.statusbar),this}function d(e,i,n,o,s){var c={cache:!1,contentType:!1,processData:!1,forceSync:!1,data:i.formData,formData:i.fileData,dataType:i.returnType,beforeSubmit:function(t,l,c){if(0!=i.onSubmit.call(this,o)){var u=i.dynamicFormData();if(u){var d=r(u);if(d)for(var h=0;h<d.length;h++)d[h]&&(void 0!=i.fileData?c.formData.append(d[h][0],d[h][1]):c.data[d[h][0]]=d[h][1])}return s.tCounter+=o.length,a(),!0}return n.statusbar.append("<div class='um-error-block'>"+i.uploadErrorStr+"</div>"),n.cancel.show(),e.remove(),n.cancel.click(function(){n.statusbar.remove()}),!1},beforeSend:function(e,a){n.progressDiv.show(),n.cancel.hide(),n.done.hide(),i.showAbort&&(n.abort.show(),n.abort.click(function(){e.abort(),s.selectedFiles-=o.length})),t.formdata?n.progressbar.width("1%"):n.progressbar.width("5%")},uploadProgress:function(e,t,a,r){r>98&&(r=98);var o=r+"%";r>1&&n.progressbar.width(o),i.showProgress&&(n.progressbar.html(o),n.progressbar.css("text-align","center"))},success:function(t,a,r){s.responses.push(t),n.progressbar.width("100%"),i.showProgress&&(n.progressbar.html("100%"),n.progressbar.css("text-align","center")),n.abort.hide(),i.onSuccess.call(this,o,t,r),i.showStatusAfterSuccess?(i.showDone?(n.done.show(),n.done.click(function(){n.statusbar.hide("slow"),n.statusbar.remove()})):n.done.hide(),i.showDelete?(n.del.show(),n.del.click(function(){n.statusbar.hide().remove(),i.deleteCallback&&i.deleteCallback.call(this,t,n),s.selectedFiles-=o.length,l(i,s)})):n.del.hide()):(n.statusbar.hide("slow"),n.statusbar.remove()),e.remove(),s.sCounter+=o.length},error:function(t,a,r){n.abort.hide(),"abort"==t.statusText?(n.statusbar.hide("slow").remove(),l(i,s)):(i.onError.call(this,o,a,r),i.showStatusAfterError?(n.progressDiv.hide(),n.statusbar.append("<span class='um-error-block'>ERROR: "+r+"</span>")):(n.statusbar.hide(),n.statusbar.remove()),s.selectedFiles-=o.length),e.remove(),s.fCounter+=o.length}};i.autoSubmit?e.ajaxSubmit(c):(i.showCancel&&(n.cancel.show(),n.cancel.click(function(){e.remove(),n.statusbar.remove(),s.selectedFiles-=o.length,l(i,s)})),e.ajaxForm(c))}var h=e.extend({url:"",method:"POST",enctype:"multipart/form-data",formData:null,returnType:null,allowedTypes:"*",fileName:"file",formData:{},dynamicFormData:function(){return{}},maxFileSize:-1,maxFileCount:-1,multiple:!0,dragDrop:!0,autoSubmit:!0,showCancel:!0,showAbort:!0,showDone:!0,showDelete:!1,showError:!0,showStatusAfterSuccess:!0,showStatusAfterError:!0,showFileCounter:!0,fileCounterStyle:"). ",showProgress:!1,onSelect:function(e){return!0},onSubmit:function(e,t){},onSuccess:function(e,t,i){},onError:function(e,t,i){},deleteCallback:!1,afterUploadAll:!1,uploadButtonClass:"upload",dragDropStr:"",abortStr:"Abort",cancelStr:"Cancel",deletelStr:"Delete",doneStr:"Done",multiDragErrorStr:"Multiple File Drag &amp; Drop is not allowed.",extErrorStr:"",sizeErrorStr:"",uploadErrorStr:"Upload is not allowed",maxFileCountErrorStr:""},i);this.fileCounter=1,this.selectedFiles=0,this.fCounter=0,this.sCounter=0,this.tCounter=0;var p="upload-"+(new Date).getTime();this.formGroup=p,this.hide(),this.errorLog=e("<div></div>"),this.after(this.errorLog),this.responses=[],t.formdata||(h.dragDrop=!1),t.formdata||(h.multiple=!1);var f=this,m=e("<div>"+e(this).html()+"</div>");e(m).addClass(h.uploadButtonClass),function v(){if(e.fn.ajaxForm){if(h.dragDrop){var t=e('<div class="ajax-upload-dragdrop" style="vertical-align:top;"></div>');e(f).before(t),e(t).append(m),e(t).prepend(e(h.dragDropStr)),n(f,h,t)}else e(f).before(m);c(f,p,h,m)}else window.setTimeout(v,10)}(),this.startUpload=function(){e("."+this.formGroup).each(function(t,i){e(this).is("form")&&e(this).submit()})},this.stopUpload=function(){e(".upload-red").each(function(t,i){e(this).hasClass(f.formGroup)&&e(this).click()})},this.getResponses=function(){return this.responses};var g=!1;return this}}(jQuery),function(e){"function"==typeof define&&define.amd?define("picker",["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):this.Picker=e(jQuery)}(function(e){function t(r,o,l,h){function p(){return t._.node("div",t._.node("div",t._.node("div",t._.node("div",Q.component.nodes(_.open),S.box),S.wrap),S.frame),S.holder,'tabindex="-1"')}function f(){j.data(o,Q).addClass(S.input).val(j.data("value")?Q.get("select",C.format):r.value),C.editable||j.on("focus."+_.id+" click."+_.id,function(e){e.preventDefault(),Q.open()}).on("keydown."+_.id,w),n(r,{haspopup:!0,expanded:!1,readonly:!1,owns:r.id+"_root"})}function m(){n(Q.$root[0],"hidden",!0)}function g(){Q.$holder.on({keydown:w,"focus.toOpen":b,blur:function(){j.removeClass(S.target)},focusin:function(e){Q.$root.removeClass(S.focused),e.stopPropagation()},"mousedown click":function(t){var i=t.target;i!=Q.$holder[0]&&(t.stopPropagation(),"mousedown"!=t.type||e(i).is("input, select, textarea, button, option")||(t.preventDefault(),Q.$holder[0].focus()))}}).on("click","[data-pick], [data-nav], [data-clear], [data-close]",function(){var t=e(this),i=t.data(),a=t.hasClass(S.navDisabled)||t.hasClass(S.disabled),n=s();n=n&&(n.type||n.href),(a||n&&!e.contains(Q.$root[0],n))&&Q.$holder[0].focus(),!a&&i.nav?Q.set("highlight",Q.component.item.highlight,{nav:i.nav}):!a&&"pick"in i?(Q.set("select",i.pick),C.closeOnSelect&&Q.close(!0)):i.clear?(Q.clear(),C.closeOnClear&&Q.close(!0)):i.close&&Q.close(!0)})}function v(){var t;C.hiddenName===!0?(t=r.name,r.name=""):(t=["string"==typeof C.hiddenPrefix?C.hiddenPrefix:"","string"==typeof C.hiddenSuffix?C.hiddenSuffix:"_submit"],t=t[0]+r.name+t[1]),Q._hidden=e('<input type=hidden name="'+t+'"'+(j.data("value")||r.value?' value="'+Q.get("select",C.formatSubmit)+'"':"")+">")[0],j.on("change."+_.id,function(){Q._hidden.value=r.value?Q.get("select",C.formatSubmit):""})}function y(){x&&d?Q.$holder.find("."+S.frame).one("transitionend",function(){Q.$holder[0].focus()}):Q.$holder[0].focus()}function b(e){e.stopPropagation(),j.addClass(S.target),Q.$root.addClass(S.focused),Q.open()}function w(e){var t=e.keyCode,i=/^(8|46)#x2F;.test(t);return 27==t?(Q.close(!0),!1):void((32==t||i||!_.open&&Q.component.key[t])&&(e.preventDefault(),e.stopPropagation(),i?Q.clear().close():Q.open()))}if(!r)return t;var x=!1,_={id:r.id||"P"+Math.abs(~~(Math.random()*new Date))},C=l?e.extend(!0,{},l.defaults,h):h||{},S=e.extend({},t.klasses(),C.klass),j=e(r),k=function(){return this.start()},Q=k.prototype={constructor:k,$node:j,start:function(){return _&&_.start?Q:(_.methods={},_.start=!0,_.open=!1,_.type=r.type,r.autofocus=r==s(),r.readOnly=!C.editable,r.id=r.id||_.id,"text"!=r.type&&(r.type="text"),Q.component=new l(Q,C),Q.$root=e('<div class="'+S.picker+'" id="'+r.id+'_root" />'),m(),Q.$holder=e(p()).appendTo(Q.$root),g(),C.formatSubmit&&v(),f(),C.containerHidden?e(C.containerHidden).append(Q._hidden):j.after(Q._hidden),C.container?e(C.container).append(Q.$root):j.after(Q.$root),Q.on({start:Q.component.onStart,render:Q.component.onRender,stop:Q.component.onStop,open:Q.component.onOpen,close:Q.component.onClose,set:Q.component.onSet}).on({start:C.onStart,render:C.onRender,stop:C.onStop,open:C.onOpen,close:C.onClose,set:C.onSet}),x=i(Q.$holder[0]),r.autofocus&&Q.open(),Q.trigger("start").trigger("render"))},render:function(t){return t?(Q.$holder=e(p()),g(),Q.$root.html(Q.$holder)):Q.$root.find("."+S.box).html(Q.component.nodes(_.open)),Q.trigger("render")},stop:function(){return _.start?(Q.close(),Q._hidden&&Q._hidden.parentNode.removeChild(Q._hidden),Q.$root.remove(),j.removeClass(S.input).removeData(o),setTimeout(function(){j.off("."+_.id)},0),r.type=_.type,r.readOnly=!1,Q.trigger("stop"),_.methods={},_.start=!1,Q):Q},open:function(i){return _.open?Q:(j.addClass(S.active),n(r,"expanded",!0),setTimeout(function(){Q.$root.addClass(S.opened),n(Q.$root[0],"hidden",!1)},0),i!==!1&&(_.open=!0,x&&u.css("overflow","hidden").css("padding-right","+="+a()),y(),c.on("click."+_.id+" focusin."+_.id,function(e){var t=e.target;t!=r&&t!=document&&3!=e.which&&Q.close(t===Q.$holder[0])}).on("keydown."+_.id,function(i){var a=i.keyCode,n=Q.component.key[a],r=i.target;27==a?Q.close(!0):r!=Q.$holder[0]||!n&&13!=a?e.contains(Q.$root[0],r)&&13==a&&(i.preventDefault(),r.click()):(i.preventDefault(),n?t._.trigger(Q.component.key.go,Q,[t._.trigger(n)]):Q.$root.find("."+S.highlighted).hasClass(S.disabled)||(Q.set("select",Q.component.item.highlight),C.closeOnSelect&&Q.close(!0)))})),Q.trigger("open"))},close:function(e){return e&&(C.editable?r.focus():(Q.$holder.off("focus.toOpen").focus(),setTimeout(function(){Q.$holder.on("focus.toOpen",b)},0))),j.removeClass(S.active),n(r,"expanded",!1),setTimeout(function(){Q.$root.removeClass(S.opened+" "+S.focused),n(Q.$root[0],"hidden",!0)},0),_.open?(_.open=!1,x&&u.css("overflow","").css("padding-right","-="+a()),c.off("."+_.id),Q.trigger("close")):Q},clear:function(e){return Q.set("clear",null,e)},set:function(t,i,a){var n,r,o=e.isPlainObject(t),s=o?t:{};if(a=o&&e.isPlainObject(i)?i:a||{},t){o||(s[t]=i);for(n in s)r=s[n],n in Q.component.item&&(void 0===r&&(r=null),Q.component.set(n,r,a)),("select"==n||"clear"==n)&&j.val("clear"==n?"":Q.get(n,C.format)).trigger("change");Q.render()}return a.muted?Q:Q.trigger("set",s)},get:function(e,i){if(e=e||"value",null!=_[e])return _[e];if("valueSubmit"==e){if(Q._hidden)return Q._hidden.value;e="value"}if("value"==e)return r.value;if(e in Q.component.item){if("string"==typeof i){var a=Q.component.get(e);return a?t._.trigger(Q.component.formats.toString,Q.component,[i,a]):""}return Q.component.get(e)}},on:function(t,i,a){var n,r,o=e.isPlainObject(t),s=o?t:{};if(t){o||(s[t]=i);for(n in s)r=s[n],a&&(n="_"+n),_.methods[n]=_.methods[n]||[],_.methods[n].push(r)}return Q},off:function(){var e,t,i=arguments;for(e=0,namesCount=i.length;e<namesCount;e+=1)t=i[e],t in _.methods&&delete _.methods[t];return Q},trigger:function(e,i){var a=function(e){var a=_.methods[e];a&&a.map(function(e){t._.trigger(e,Q,[i])})};return a("_"+e),a(e),Q}};return new k}function i(e){var t,i="position";return e.currentStyle?t=e.currentStyle[i]:window.getComputedStyle&&(t=getComputedStyle(e)[i]),"fixed"==t}function a(){if(u.height()<=l.height())return 0;var t=e('<div style="visibility:hidden;width:100px" />').appendTo("body"),i=t[0].offsetWidth;t.css("overflow","scroll");var a=e('<div style="width:100%" />').appendTo(t),n=a[0].offsetWidth;return t.remove(),i-n}function n(t,i,a){if(e.isPlainObject(i))for(var n in i)r(t,n,i[n]);else r(t,i,a)}function r(e,t,i){e.setAttribute(("role"==t?"":"aria-")+t,i)}function o(t,i){e.isPlainObject(t)||(t={attribute:i}),i="";for(var a in t){var n=("role"==a?"":"aria-")+a,r=t[a];i+=null==r?"":n+'="'+t[a]+'"'}return i}function s(){try{return document.activeElement}catch(e){}}var l=e(window),c=e(document),u=e(document.documentElement),d=null!=document.documentElement.style.transition;return t.klasses=function(e){return e=e||"picker",{picker:e,opened:e+"--opened",focused:e+"--focused",input:e+"__input",active:e+"__input--active",target:e+"__input--target",holder:e+"__holder",frame:e+"__frame",wrap:e+"__wrap",box:e+"__box"}},t._={group:function(e){for(var i,a="",n=t._.trigger(e.min,e);n<=t._.trigger(e.max,e,[n]);n+=e.i)i=t._.trigger(e.item,e,[n]),a+=t._.node(e.node,i[0],i[1],i[2]);return a},node:function(t,i,a,n){return i?(i=e.isArray(i)?i.join(""):i,a=a?' class="'+a+'"':"",n=n?" "+n:"","<"+t+a+n+">"+i+"</"+t+">"):""},lead:function(e){return(10>e?"0":"")+e},trigger:function(e,t,i){return"function"==typeof e?e.apply(t,i||[]):e},digits:function(e){return/\d/.test(e[1])?2:1},isDate:function(e){return{}.toString.call(e).indexOf("Date")>-1&&this.isInteger(e.getDate())},isInteger:function(e){return{}.toString.call(e).indexOf("Number")>-1&&e%1===0},ariaAttr:o},t.extend=function(i,a){e.fn[i]=function(n,r){var o=this.data(i);return"picker"==n?o:o&&"string"==typeof n?t._.trigger(o[n],o,[r]):this.each(function(){var r=e(this);r.data(i)||new t(this,i,a,n)})},e.fn[i].defaults=a.defaults},t}),function(e){"function"==typeof define&&define.amd?define(["picker","jquery"],e):"object"==typeof exports?module.exports=e(require("./picker.js"),require("jquery")):e(Picker,jQuery)}(function(e,t){function i(e,t){var i=this,a=e.$node[0],n=a.value,r=e.$node.data("value"),o=r||n,s=r?t.formatSubmit:t.format,l=function(){return a.currentStyle?"rtl"==a.currentStyle.direction:"rtl"==getComputedStyle(e.$root[0]).direction};i.settings=t,i.$node=e.$node,i.queue={min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse navigate create validate",view:"parse create validate viewset",disable:"deactivate",enable:"activate"},i.item={},i.item.clear=null,i.item.disable=(t.disable||[]).slice(0),i.item.enable=-function(e){return e[0]===!0?e.shift():-1}(i.item.disable),i.set("min",t.min).set("max",t.max).set("now"),o?i.set("select",o,{format:s,defaultValue:!0}):i.set("select",null).set("highlight",i.item.now),i.key={40:7,38:-7,39:function(){return l()?-1:1},37:function(){return l()?1:-1},go:function(e){var t=i.item.highlight,a=new Date(t.year,t.month,t.date+e);i.set("highlight",a,{interval:e}),this.render()}},e.on("render",function(){e.$root.find("."+t.klass.selectMonth).on("change",function(){var i=this.value;i&&(e.set("highlight",[e.get("view").year,i,e.get("highlight").date]),e.$root.find("."+t.klass.selectMonth).trigger("focus"))}),e.$root.find("."+t.klass.selectYear).on("change",function(){var i=this.value;i&&(e.set("highlight",[i,e.get("view").month,e.get("highlight").date]),e.$root.find("."+t.klass.selectYear).trigger("focus"))})},1).on("open",function(){var a="";i.disabled(i.get("now"))&&(a=":not(."+t.klass.buttonToday+")"),e.$root.find("button"+a+", select").attr("disabled",!1)},1).on("close",function(){e.$root.find("button, select").attr("disabled",!0)},1)}var a=7,n=6,r=e._;i.prototype.set=function(e,t,i){var a=this,n=a.item;return null===t?("clear"==e&&(e="select"),n[e]=t,a):(n["enable"==e?"disable":"flip"==e?"enable":e]=a.queue[e].split(" ").map(function(n){return t=a[n](e,t,i)}).pop(),"select"==e?a.set("highlight",n.select,i):"highlight"==e?a.set("view",n.highlight,i):e.match(/^(flip|min|max|disable|enable)#x2F;)&&(n.select&&a.disabled(n.select)&&a.set("select",n.select,i),n.highlight&&a.disabled(n.highlight)&&a.set("highlight",n.highlight,i)),a)},i.prototype.get=function(e){return this.item[e]},i.prototype.create=function(e,i,a){var n,o=this;return i=void 0===i?e:i,i==-(1/0)||i==1/0?n=i:t.isPlainObject(i)&&r.isInteger(i.pick)?i=i.obj:t.isArray(i)?(i=new Date(i[0],i[1],i[2]),i=r.isDate(i)?i:o.create().obj):i=r.isInteger(i)||r.isDate(i)?o.normalize(new Date(i),a):o.now(e,i,a),{year:n||i.getFullYear(),month:n||i.getMonth(),date:n||i.getDate(),day:n||i.getDay(),obj:n||i,pick:n||i.getTime()}},i.prototype.createRange=function(e,i){var a=this,n=function(e){return e===!0||t.isArray(e)||r.isDate(e)?a.create(e):e};return r.isInteger(e)||(e=n(e)),r.isInteger(i)||(i=n(i)),r.isInteger(e)&&t.isPlainObject(i)?e=[i.year,i.month,i.date+e]:r.isInteger(i)&&t.isPlainObject(e)&&(i=[e.year,e.month,e.date+i]),{from:n(e),to:n(i)}},i.prototype.withinRange=function(e,t){return e=this.createRange(e.from,e.to),t.pick>=e.from.pick&&t.pick<=e.to.pick},i.prototype.overlapRanges=function(e,t){var i=this;return e=i.createRange(e.from,e.to),t=i.createRange(t.from,t.to),i.withinRange(e,t.from)||i.withinRange(e,t.to)||i.withinRange(t,e.from)||i.withinRange(t,e.to)},i.prototype.now=function(e,t,i){return t=new Date,i&&i.rel&&t.setDate(t.getDate()+i.rel),this.normalize(t,i)},i.prototype.navigate=function(e,i,a){var n,r,o,s,l=t.isArray(i),c=t.isPlainObject(i),u=this.item.view;if(l||c){for(c?(r=i.year,o=i.month,s=i.date):(r=+i[0],o=+i[1],s=+i[2]),a&&a.nav&&u&&u.month!==o&&(r=u.year,o=u.month),n=new Date(r,o+(a&&a.nav?a.nav:0),1),r=n.getFullYear(),o=n.getMonth();new Date(r,o,s).getMonth()!==o;)s-=1;i=[r,o,s]}return i},i.prototype.normalize=function(e){return e.setHours(0,0,0,0),e},i.prototype.measure=function(e,t){var i=this;return t?"string"==typeof t?t=i.parse(e,t):r.isInteger(t)&&(t=i.now(e,t,{rel:t})):t="min"==e?-(1/0):1/0,t},i.prototype.viewset=function(e,t){return this.create([t.year,t.month,1])},i.prototype.validate=function(e,i,a){var n,o,s,l,c=this,u=i,d=a&&a.interval?a.interval:1,h=-1===c.item.enable,p=c.item.min,f=c.item.max,m=h&&c.item.disable.filter(function(e){if(t.isArray(e)){var a=c.create(e).pick;a<i.pick?n=!0:a>i.pick&&(o=!0)}return r.isInteger(e)}).length;if((!a||!a.nav&&!a.defaultValue)&&(!h&&c.disabled(i)||h&&c.disabled(i)&&(m||n||o)||!h&&(i.pick<=p.pick||i.pick>=f.pick)))for(h&&!m&&(!o&&d>0||!n&&0>d)&&(d*=-1);c.disabled(i)&&(Math.abs(d)>1&&(i.month<u.month||i.month>u.month)&&(i=u,d=d>0?1:-1),i.pick<=p.pick?(s=!0,d=1,i=c.create([p.year,p.month,p.date+(i.pick===p.pick?0:-1)])):i.pick>=f.pick&&(l=!0,d=-1,i=c.create([f.year,f.month,f.date+(i.pick===f.pick?0:1)])),!s||!l);)i=c.create([i.year,i.month,i.date+d]);return i},i.prototype.disabled=function(e){var i=this,a=i.item.disable.filter(function(a){return r.isInteger(a)?e.day===(i.settings.firstDay?a:a-1)%7:t.isArray(a)||r.isDate(a)?e.pick===i.create(a).pick:t.isPlainObject(a)?i.withinRange(a,e):void 0});return a=a.length&&!a.filter(function(e){return t.isArray(e)&&"inverted"==e[3]||t.isPlainObject(e)&&e.inverted}).length,-1===i.item.enable?!a:a||e.pick<i.item.min.pick||e.pick>i.item.max.pick},i.prototype.parse=function(e,t,i){var a=this,n={};return t&&"string"==typeof t?(i&&i.format||(i=i||{},i.format=a.settings.format),a.formats.toArray(i.format).map(function(e){var i=a.formats[e],o=i?r.trigger(i,a,[t,n]):e.replace(/^!/,"").length;i&&(n[e]=t.substr(0,o)),t=t.substr(o)}),[n.yyyy||n.yy,+(n.mm||n.m)-1,n.dd||n.d]):t},i.prototype.formats=function(){function e(e,t,i){var a=e.match(/[^\x00-\x7F]+|\w+/)[0];return i.mm||i.m||(i.m=t.indexOf(a)+1),a.length}function t(e){return e.match(/\w+/)[0].length}return{d:function(e,t){return e?r.digits(e):t.date},dd:function(e,t){return e?2:r.lead(t.date)},ddd:function(e,i){return e?t(e):this.settings.weekdaysShort[i.day]},dddd:function(e,i){return e?t(e):this.settings.weekdaysFull[i.day]},m:function(e,t){return e?r.digits(e):t.month+1},mm:function(e,t){return e?2:r.lead(t.month+1)},mmm:function(t,i){var a=this.settings.monthsShort;return t?e(t,a,i):a[i.month]},mmmm:function(t,i){var a=this.settings.monthsFull;return t?e(t,a,i):a[i.month]},yy:function(e,t){return e?2:(""+t.year).slice(2)},yyyy:function(e,t){return e?4:t.year},toArray:function(e){return e.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g)},toString:function(e,t){var i=this;return i.formats.toArray(e).map(function(e){return r.trigger(i.formats[e],i,[0,t])||e.replace(/^!/,"")}).join("")}}}(),i.prototype.isDateExact=function(e,i){var a=this;return r.isInteger(e)&&r.isInteger(i)||"boolean"==typeof e&&"boolean"==typeof i?e===i:(r.isDate(e)||t.isArray(e))&&(r.isDate(i)||t.isArray(i))?a.create(e).pick===a.create(i).pick:t.isPlainObject(e)&&t.isPlainObject(i)?a.isDateExact(e.from,i.from)&&a.isDateExact(e.to,i.to):!1},i.prototype.isDateOverlap=function(e,i){var a=this,n=a.settings.firstDay?1:0;return r.isInteger(e)&&(r.isDate(i)||t.isArray(i))?(e=e%7+n,e===a.create(i).day+1):r.isInteger(i)&&(r.isDate(e)||t.isArray(e))?(i=i%7+n,i===a.create(e).day+1):t.isPlainObject(e)&&t.isPlainObject(i)?a.overlapRanges(e,i):!1},i.prototype.flipEnable=function(e){var t=this.item;t.enable=e||(-1==t.enable?1:-1)},i.prototype.deactivate=function(e,i){var a=this,n=a.item.disable.slice(0);return"flip"==i?a.flipEnable():i===!1?(a.flipEnable(1),n=[]):i===!0?(a.flipEnable(-1),n=[]):i.map(function(e){for(var i,o=0;o<n.length;o+=1)if(a.isDateExact(e,n[o])){i=!0;break}i||(r.isInteger(e)||r.isDate(e)||t.isArray(e)||t.isPlainObject(e)&&e.from&&e.to)&&n.push(e)}),n},i.prototype.activate=function(e,i){var a=this,n=a.item.disable,o=n.length;return"flip"==i?a.flipEnable():i===!0?(a.flipEnable(1),n=[]):i===!1?(a.flipEnable(-1),n=[]):i.map(function(e){var i,s,l,c;for(l=0;o>l;l+=1){if(s=n[l],a.isDateExact(s,e)){i=n[l]=null,c=!0;break}if(a.isDateOverlap(s,e)){t.isPlainObject(e)?(e.inverted=!0,i=e):t.isArray(e)?(i=e,i[3]||i.push("inverted")):r.isDate(e)&&(i=[e.getFullYear(),e.getMonth(),e.getDate(),"inverted"]);break}}if(i)for(l=0;o>l;l+=1)if(a.isDateExact(n[l],e)){n[l]=null;break}if(c)for(l=0;o>l;l+=1)if(a.isDateOverlap(n[l],e)){n[l]=null;break}i&&n.push(i)}),n.filter(function(e){return null!=e})},i.prototype.nodes=function(e){var t=this,i=t.settings,o=t.item,s=o.now,l=o.select,c=o.highlight,u=o.view,d=o.disable,h=o.min,p=o.max,f=function(e,t){return i.firstDay&&(e.push(e.shift()),t.push(t.shift())),r.node("thead",r.node("tr",r.group({min:0,max:a-1,i:1,node:"th",item:function(a){return[e[a],i.klass.weekdays,'scope=col title="'+t[a]+'"']}})))}((i.showWeekdaysFull?i.weekdaysFull:i.weekdaysShort).slice(0),i.weekdaysFull.slice(0)),m=function(e){return r.node("div"," ",i.klass["nav"+(e?"Next":"Prev")]+(e&&u.year>=p.year&&u.month>=p.month||!e&&u.year<=h.year&&u.month<=h.month?" "+i.klass.navDisabled:""),"data-nav="+(e||-1)+" "+r.ariaAttr({role:"button",controls:t.$node[0].id+"_table"})+' title="'+(e?i.labelMonthNext:i.labelMonthPrev)+'"')},g=function(){var a=i.showMonthsShort?i.monthsShort:i.monthsFull;return i.selectMonths?r.node("select",r.group({min:0,max:11,i:1,node:"option",item:function(e){return[a[e],0,"value="+e+(u.month==e?" selected":"")+(u.year==h.year&&e<h.month||u.year==p.year&&e>p.month?" disabled":"")]}}),i.klass.selectMonth,(e?"":"disabled")+" "+r.ariaAttr({controls:t.$node[0].id+"_table"})+' title="'+i.labelMonthSelect+'"'):r.node("div",a[u.month],i.klass.month)},v=function(){var a=u.year,n=i.selectYears===!0?5:~~(i.selectYears/2);if(n){var o=h.year,s=p.year,l=a-n,c=a+n;if(o>l&&(c+=o-l,l=o),c>s){var d=l-o,f=c-s;l-=d>f?f:d,c=s}return r.node("select",r.group({min:l,max:c,i:1,node:"option",item:function(e){return[e,0,"value="+e+(a==e?" selected":"")]}}),i.klass.selectYear,(e?"":"disabled")+" "+r.ariaAttr({controls:t.$node[0].id+"_table"})+' title="'+i.labelYearSelect+'"')}return r.node("div",a,i.klass.year)};return r.node("div",(i.selectYears?v()+g():g()+v())+m()+m(1),i.klass.header)+r.node("table",f+r.node("tbody",r.group({min:0,max:n-1,i:1,node:"tr",item:function(e){var n=i.firstDay&&0===t.create([u.year,u.month,1]).day?-7:0;return[r.group({min:a*e-u.day+n+1,max:function(){return this.min+a-1},i:1,node:"td",item:function(e){e=t.create([u.year,u.month,e+(i.firstDay?1:0)]);var a=l&&l.pick==e.pick,n=c&&c.pick==e.pick,o=d&&t.disabled(e)||e.pick<h.pick||e.pick>p.pick,f=r.trigger(t.formats.toString,t,[i.format,e]);return[r.node("div",e.date,function(t){return t.push(u.month==e.month?i.klass.infocus:i.klass.outfocus),s.pick==e.pick&&t.push(i.klass.now),a&&t.push(i.klass.selected),n&&t.push(i.klass.highlighted),o&&t.push(i.klass.disabled),t.join(" ")}([i.klass.day]),"data-pick="+e.pick+" "+r.ariaAttr({role:"gridcell",label:f,selected:a&&t.$node.val()===f?!0:null,activedescendant:n?!0:null,disabled:o?!0:null})),"",r.ariaAttr({role:"presentation"})]}})]}})),i.klass.table,'id="'+t.$node[0].id+'_table" '+r.ariaAttr({role:"grid",controls:t.$node[0].id,readonly:!0}))+r.node("div",r.node("button",i.today,i.klass.buttonToday,"type=button data-pick="+s.pick+(e&&!t.disabled(s)?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id}))+r.node("button",i.clear,i.klass.buttonClear,"type=button data-clear=1"+(e?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id}))+r.node("button",i.close,i.klass.buttonClose,"type=button data-close=true "+(e?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id})),i.klass.footer)},i.defaults=function(e){return{labelMonthNext:"Next month",labelMonthPrev:"Previous month",labelMonthSelect:"Select a month",labelYearSelect:"Select a year",monthsFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdaysFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],today:"Today",clear:"Clear",close:"Close",closeOnSelect:!0,closeOnClear:!0,format:"d mmmm, yyyy",klass:{table:e+"table",header:e+"header",navPrev:e+"nav--prev",navNext:e+"nav--next",navDisabled:e+"nav--disabled",month:e+"month",year:e+"year",selectMonth:e+"select--month",selectYear:e+"select--year",weekdays:e+"weekday",day:e+"day",disabled:e+"day--disabled",selected:e+"day--selected",highlighted:e+"day--highlighted",now:e+"day--today",infocus:e+"day--infocus",outfocus:e+"day--outfocus",footer:e+"footer",buttonClear:e+"button--clear",buttonToday:e+"button--today",buttonClose:e+"button--close"}}}(e.klasses().picker+"__"),e.extend("pickadate",i)}),function(e){"function"==typeof define&&define.amd?define(["picker","jquery"],e):"object"==typeof exports?module.exports=e(require("./picker.js"),require("jquery")):e(Picker,jQuery)}(function(e,t){function i(e,t){var i=this,a=e.$node[0].value,n=e.$node.data("value"),r=n||a,o=n?t.formatSubmit:t.format;i.settings=t,i.$node=e.$node,i.queue={interval:"i",min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse create validate",view:"parse create validate",disable:"deactivate",enable:"activate"},i.item={},i.item.clear=null,i.item.interval=t.interval||30,i.item.disable=(t.disable||[]).slice(0),i.item.enable=-function(e){return e[0]===!0?e.shift():-1}(i.item.disable),i.set("min",t.min).set("max",t.max).set("now"),r?i.set("select",r,{format:o}):i.set("select",null).set("highlight",i.item.now),i.key={40:1,38:-1,39:1,37:-1,go:function(e){i.set("highlight",i.item.highlight.pick+e*i.item.interval,{interval:e*i.item.interval}),this.render()}},e.on("render",function(){var i=e.$root.children(),a=i.find("."+t.klass.viewset),n=function(e){return["webkit","moz","ms","o",""].map(function(t){
5
return(t?"-"+t+"-":"")+e})},r=function(e,t){n("transform").map(function(i){e.css(i,t)}),n("transition").map(function(i){e.css(i,t)})};a.length&&(r(i,"none"),i[0].scrollTop=~~a.position().top-2*a[0].clientHeight,r(i,""))},1).on("open",function(){e.$root.find("button").attr("disabled",!1)},1).on("close",function(){e.$root.find("button").attr("disabled",!0)},1)}var a=24,n=60,r=12,o=a*n,s=e._;i.prototype.set=function(e,t,i){var a=this,n=a.item;return null===t?("clear"==e&&(e="select"),n[e]=t,a):(n["enable"==e?"disable":"flip"==e?"enable":e]=a.queue[e].split(" ").map(function(n){return t=a[n](e,t,i)}).pop(),"select"==e?a.set("highlight",n.select,i):"highlight"==e?a.set("view",n.highlight,i):"interval"==e?a.set("min",n.min,i).set("max",n.max,i):e.match(/^(flip|min|max|disable|enable)#x2F;)&&(n.select&&a.disabled(n.select)&&a.set("select",t,i),n.highlight&&a.disabled(n.highlight)&&a.set("highlight",t,i),"min"==e&&a.set("max",n.max,i)),a)},i.prototype.get=function(e){return this.item[e]},i.prototype.create=function(e,i,r){var l=this;return i=void 0===i?e:i,s.isDate(i)&&(i=[i.getHours(),i.getMinutes()]),t.isPlainObject(i)&&s.isInteger(i.pick)?i=i.pick:t.isArray(i)?i=+i[0]*n+ +i[1]:s.isInteger(i)||(i=l.now(e,i,r)),"max"==e&&i<l.item.min.pick&&(i+=o),"min"!=e&&"max"!=e&&(i-l.item.min.pick)%l.item.interval!==0&&(i+=l.item.interval),i=l.normalize(e,i,r),{hour:~~(a+i/n)%a,mins:(n+i%n)%n,time:(o+i)%o,pick:i%o}},i.prototype.createRange=function(e,i){var a=this,n=function(e){return e===!0||t.isArray(e)||s.isDate(e)?a.create(e):e};return s.isInteger(e)||(e=n(e)),s.isInteger(i)||(i=n(i)),s.isInteger(e)&&t.isPlainObject(i)?e=[i.hour,i.mins+e*a.settings.interval]:s.isInteger(i)&&t.isPlainObject(e)&&(i=[e.hour,e.mins+i*a.settings.interval]),{from:n(e),to:n(i)}},i.prototype.withinRange=function(e,t){return e=this.createRange(e.from,e.to),t.pick>=e.from.pick&&t.pick<=e.to.pick},i.prototype.overlapRanges=function(e,t){var i=this;return e=i.createRange(e.from,e.to),t=i.createRange(t.from,t.to),i.withinRange(e,t.from)||i.withinRange(e,t.to)||i.withinRange(t,e.from)||i.withinRange(t,e.to)},i.prototype.now=function(e,t){var i,a=this.item.interval,r=new Date,o=r.getHours()*n+r.getMinutes(),l=s.isInteger(t);return o-=o%a,i=0>t&&-a>=a*t+o,o+="min"==e&&i?0:a,l&&(o+=a*(i&&"max"!=e?t+1:t)),o},i.prototype.normalize=function(e,t){var i=this.item.interval,a=this.item.min&&this.item.min.pick||0;return t-="min"==e?0:(t-a)%i},i.prototype.measure=function(e,i,r){var o=this;return i||(i="min"==e?[0,0]:[a-1,n-1]),"string"==typeof i?i=o.parse(e,i):i===!0||s.isInteger(i)?i=o.now(e,i,r):t.isPlainObject(i)&&s.isInteger(i.pick)&&(i=o.normalize(e,i.pick,r)),i},i.prototype.validate=function(e,t,i){var a=this,n=i&&i.interval?i.interval:a.item.interval;return a.disabled(t)&&(t=a.shift(t,n)),t=a.scope(t),a.disabled(t)&&(t=a.shift(t,-1*n)),t},i.prototype.disabled=function(e){var i=this,a=i.item.disable.filter(function(a){return s.isInteger(a)?e.hour==a:t.isArray(a)||s.isDate(a)?e.pick==i.create(a).pick:t.isPlainObject(a)?i.withinRange(a,e):void 0});return a=a.length&&!a.filter(function(e){return t.isArray(e)&&"inverted"==e[2]||t.isPlainObject(e)&&e.inverted}).length,-1===i.item.enable?!a:a||e.pick<i.item.min.pick||e.pick>i.item.max.pick},i.prototype.shift=function(e,t){var i=this,a=i.item.min.pick,n=i.item.max.pick;for(t=t||i.item.interval;i.disabled(e)&&(e=i.create(e.pick+=t),!(e.pick<=a||e.pick>=n)););return e},i.prototype.scope=function(e){var t=this.item.min.pick,i=this.item.max.pick;return this.create(e.pick>i?i:e.pick<t?t:e)},i.prototype.parse=function(e,t,i){var a,r,o,l,c,u=this,d={};if(!t||"string"!=typeof t)return t;i&&i.format||(i=i||{},i.format=u.settings.format),u.formats.toArray(i.format).map(function(e){var i,a=u.formats[e],n=a?s.trigger(a,u,[t,d]):e.replace(/^!/,"").length;a&&(i=t.substr(0,n),d[e]=i.match(/^\d+#x2F;)?+i:i),t=t.substr(n)});for(l in d)c=d[l],s.isInteger(c)?l.match(/^(h|hh)#x2F;i)?(a=c,("h"==l||"hh"==l)&&(a%=12)):"i"==l&&(r=c):l.match(/^a#x2F;i)&&c.match(/^p/i)&&("h"in d||"hh"in d)&&(o=!0);return(o?a+12:a)*n+r},i.prototype.formats={h:function(e,t){return e?s.digits(e):t.hour%r||r},hh:function(e,t){return e?2:s.lead(t.hour%r||r)},H:function(e,t){return e?s.digits(e):""+t.hour%24},HH:function(e,t){return e?s.digits(e):s.lead(t.hour%24)},i:function(e,t){return e?2:s.lead(t.mins)},a:function(e,t){return e?4:o/2>t.time%o?"a.m.":"p.m."},A:function(e,t){return e?2:o/2>t.time%o?"AM":"PM"},toArray:function(e){return e.split(/(h{1,2}|H{1,2}|i|a|A|!.)/g)},toString:function(e,t){var i=this;return i.formats.toArray(e).map(function(e){return s.trigger(i.formats[e],i,[0,t])||e.replace(/^!/,"")}).join("")}},i.prototype.isTimeExact=function(e,i){var a=this;return s.isInteger(e)&&s.isInteger(i)||"boolean"==typeof e&&"boolean"==typeof i?e===i:(s.isDate(e)||t.isArray(e))&&(s.isDate(i)||t.isArray(i))?a.create(e).pick===a.create(i).pick:t.isPlainObject(e)&&t.isPlainObject(i)?a.isTimeExact(e.from,i.from)&&a.isTimeExact(e.to,i.to):!1},i.prototype.isTimeOverlap=function(e,i){var a=this;return s.isInteger(e)&&(s.isDate(i)||t.isArray(i))?e===a.create(i).hour:s.isInteger(i)&&(s.isDate(e)||t.isArray(e))?i===a.create(e).hour:t.isPlainObject(e)&&t.isPlainObject(i)?a.overlapRanges(e,i):!1},i.prototype.flipEnable=function(e){var t=this.item;t.enable=e||(-1==t.enable?1:-1)},i.prototype.deactivate=function(e,i){var a=this,n=a.item.disable.slice(0);return"flip"==i?a.flipEnable():i===!1?(a.flipEnable(1),n=[]):i===!0?(a.flipEnable(-1),n=[]):i.map(function(e){for(var i,r=0;r<n.length;r+=1)if(a.isTimeExact(e,n[r])){i=!0;break}i||(s.isInteger(e)||s.isDate(e)||t.isArray(e)||t.isPlainObject(e)&&e.from&&e.to)&&n.push(e)}),n},i.prototype.activate=function(e,i){var a=this,n=a.item.disable,r=n.length;return"flip"==i?a.flipEnable():i===!0?(a.flipEnable(1),n=[]):i===!1?(a.flipEnable(-1),n=[]):i.map(function(e){var i,o,l,c;for(l=0;r>l;l+=1){if(o=n[l],a.isTimeExact(o,e)){i=n[l]=null,c=!0;break}if(a.isTimeOverlap(o,e)){t.isPlainObject(e)?(e.inverted=!0,i=e):t.isArray(e)?(i=e,i[2]||i.push("inverted")):s.isDate(e)&&(i=[e.getFullYear(),e.getMonth(),e.getDate(),"inverted"]);break}}if(i)for(l=0;r>l;l+=1)if(a.isTimeExact(n[l],e)){n[l]=null;break}if(c)for(l=0;r>l;l+=1)if(a.isTimeOverlap(n[l],e)){n[l]=null;break}i&&n.push(i)}),n.filter(function(e){return null!=e})},i.prototype.i=function(e,t){return s.isInteger(t)&&t>0?t:this.item.interval},i.prototype.nodes=function(e){var t=this,i=t.settings,a=t.item.select,n=t.item.highlight,r=t.item.view,o=t.item.disable;return s.node("ul",s.group({min:t.item.min.pick,max:t.item.max.pick,i:t.item.interval,node:"li",item:function(e){e=t.create(e);var l=e.pick,c=a&&a.pick==l,u=n&&n.pick==l,d=o&&t.disabled(e),h=s.trigger(t.formats.toString,t,[i.format,e]);return[s.trigger(t.formats.toString,t,[s.trigger(i.formatLabel,t,[e])||i.format,e]),function(e){return c&&e.push(i.klass.selected),u&&e.push(i.klass.highlighted),r&&r.pick==l&&e.push(i.klass.viewset),d&&e.push(i.klass.disabled),e.join(" ")}([i.klass.listItem]),"data-pick="+e.pick+" "+s.ariaAttr({role:"option",label:h,selected:c&&t.$node.val()===h?!0:null,activedescendant:u?!0:null,disabled:d?!0:null})]}})+s.node("li",s.node("button",i.clear,i.klass.buttonClear,"type=button data-clear=1"+(e?"":" disabled")+" "+s.ariaAttr({controls:t.$node[0].id})),"",s.ariaAttr({role:"presentation"})),i.klass.list,s.ariaAttr({role:"listbox",controls:t.$node[0].id}))},i.defaults=function(e){return{clear:"Clear",format:"h:i A",interval:30,closeOnSelect:!0,closeOnClear:!0,klass:{picker:e+" "+e+"--time",holder:e+"__holder",list:e+"__list",listItem:e+"__list-item",disabled:e+"__list-item--disabled",selected:e+"__list-item--selected",highlighted:e+"__list-item--highlighted",viewset:e+"__list-item--viewset",now:e+"__list-item--now",buttonClear:e+"__button--clear"}}}(e.klasses().picker),e.extend("pickatime",i)}),[].map||(Array.prototype.map=function(e,t){for(var i=this,a=i.length,n=new Array(a),r=0;a>r;r++)r in i&&(n[r]=e.call(t,i[r],r,i));return n}),[].filter||(Array.prototype.filter=function(e){if(null==this)throw new TypeError;var t=Object(this),i=t.length>>>0;if("function"!=typeof e)throw new TypeError;for(var a=[],n=arguments[1],r=0;i>r;r++)if(r in t){var o=t[r];e.call(n,o,r,t)&&a.push(o)}return a}),[].indexOf||(Array.prototype.indexOf=function(e){if(null==this)throw new TypeError;var t=Object(this),i=t.length>>>0;if(0===i)return-1;var a=0;if(arguments.length>1&&(a=Number(arguments[1]),a!=a?a=0:0!==a&&a!=1/0&&a!=-(1/0)&&(a=(a>0||-1)*Math.floor(Math.abs(a)))),a>=i)return-1;for(var n=a>=0?a:Math.max(i-Math.abs(a),0);i>n;n++)if(n in t&&t[n]===e)return n;return-1});var nativeSplit=String.prototype.split,compliantExecNpcg=void 0===/()??/.exec("")[1];String.prototype.split=function(e,t){var i=this;if("[object RegExp]"!==Object.prototype.toString.call(e))return nativeSplit.call(i,e,t);var a,n,r,o,s=[],l=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":""),c=0;for(e=new RegExp(e.source,l+"g"),i+="",compliantExecNpcg||(a=new RegExp("^"+e.source+"$(?!\\s)",l)),t=void 0===t?-1>>>0:t>>>0;(n=e.exec(i))&&(r=n.index+n[0].length,!(r>c&&(s.push(i.slice(c,n.index)),!compliantExecNpcg&&n.length>1&&n[0].replace(a,function(){for(var e=1;e<arguments.length-2;e++)void 0===arguments[e]&&(n[e]=void 0)}),n.length>1&&n.index<i.length&&Array.prototype.push.apply(s,n.slice(1)),o=n[0].length,c=r,s.length>=t)));)e.lastIndex===n.index&&e.lastIndex++;return c===i.length?(o||!e.test(""))&&s.push(""):s.push(i.slice(c)),s.length>t?s.slice(0,t):s},function(e){"use strict";var t={init:function(i){return this.each(function(){this.self=e(this),t.destroy.call(this.self),this.opt=e.extend(!0,{},e.fn.raty.defaults,i),t._adjustCallback.call(this),t._adjustNumber.call(this),"img"!==this.opt.starType&&t._adjustStarType.call(this),t._adjustPath.call(this),t._createStars.call(this),this.opt.cancel&&t._createCancel.call(this),this.opt.precision&&t._adjustPrecision.call(this),t._createScore.call(this),t._apply.call(this,this.opt.score),t._target.call(this,this.opt.score),this.opt.readOnly?t._lock.call(this):(this.style.cursor="pointer",t._binds.call(this)),this.self.data("options",this.opt)})},_adjustCallback:function(){for(var e=["number","readOnly","score","scoreName","target"],t=0;t<e.length;t++)"function"==typeof this.opt[e[t]]&&(this.opt[e[t]]=this.opt[e[t]].call(this))},_adjustNumber:function(){this.opt.number=t._between(this.opt.number,1,this.opt.numberMax)},_adjustPath:function(){this.opt.path=this.opt.path||"",this.opt.path&&"/"!==this.opt.path.charAt(this.opt.path.length-1)&&(this.opt.path+="/")},_adjustPrecision:function(){this.opt.half=!0,this.opt.targetType="score"},_adjustStarType:function(){this.opt.path="";for(var e=["cancelOff","cancelOn","starHalf","starOff","starOn"],t=0;t<e.length;t++)this.opt[e[t]]=this.opt[e[t]].replace(".","-")},_apply:function(e){t._fill.call(this,e),e&&(e>0&&this.score.val(t._between(e,0,this.opt.number)),t._roundStars.call(this,e))},_between:function(e,t,i){return Math.min(Math.max(parseFloat(e),t),i)},_binds:function(){this.cancel&&(t._bindOverCancel.call(this),t._bindClickCancel.call(this),t._bindOutCancel.call(this)),t._bindOver.call(this),t._bindClick.call(this),t._bindOut.call(this)},_bindClick:function(){var t=this;t.stars.on("click.raty",function(i){var a=e(this);t.score.val(t.opt.half||t.opt.precision?t.self.data("score"):this.alt||a.data("alt")),t.opt.click&&t.opt.click.call(t,+t.score.val(),i)})},_bindClickCancel:function(){var e=this;e.cancel.on("click.raty",function(t){e.score.removeAttr("value"),e.opt.click&&e.opt.click.call(e,null,t)})},_bindOut:function(){var e=this;e.self.on("mouseleave.raty",function(i){var a=+e.score.val()||void 0;t._apply.call(e,a),t._target.call(e,a,i),e.opt.mouseout&&e.opt.mouseout.call(e,a,i)})},_bindOutCancel:function(){var e=this;e.cancel.on("mouseleave.raty",function(i){var a=e.opt.cancelOff;if("img"!==e.opt.starType&&(a=e.opt.cancelClass+" "+a),t._setIcon.call(e,this,a),e.opt.mouseout){var n=+e.score.val()||void 0;e.opt.mouseout.call(e,n,i)}})},_bindOver:function(){var e=this,i=e.opt.half?"mousemove.raty":"mouseover.raty";e.stars.on(i,function(i){var a=t._getScoreByPosition.call(e,i,this);t._fill.call(e,a),e.opt.half&&(t._roundStars.call(e,a),e.self.data("score",a)),t._target.call(e,a,i),e.opt.mouseover&&e.opt.mouseover.call(e,a,i)})},_bindOverCancel:function(){var e=this;e.cancel.on("mouseover.raty",function(i){var a=e.opt.path+e.opt.starOff,n=e.opt.cancelOn;"img"===e.opt.starType?e.stars.attr("src",a):(n=e.opt.cancelClass+" "+n,e.stars.attr("class",a)),t._setIcon.call(e,this,n),t._target.call(e,null,i),e.opt.mouseover&&e.opt.mouseover.call(e,null)})},_buildScoreField:function(){return e("<input />",{name:this.opt.scoreName,type:"hidden"}).appendTo(this)},_createCancel:function(){var t=this.opt.path+this.opt.cancelOff,i=e("<"+this.opt.starType+" />",{title:this.opt.cancelHint,"class":this.opt.cancelClass});"img"===this.opt.starType?i.attr({src:t,alt:"x"}):i.attr("data-alt","x").addClass(t),"left"===this.opt.cancelPlace?this.self.prepend("&#160;").prepend(i):this.self.append("&#160;").append(i),this.cancel=i},_createScore:function(){var i=e(this.opt.targetScore);this.score=i.length?i:t._buildScoreField.call(this)},_createStars:function(){for(var i=1;i<=this.opt.number;i++){var a=t._nameForIndex.call(this,i),n={alt:i,src:this.opt.path+this.opt[a]};"img"!==this.opt.starType&&(n={"data-alt":i,"class":n.src}),n.title=t._getHint.call(this,i),e("<"+this.opt.starType+" />",n).appendTo(this),this.opt.space&&this.self.append(i<this.opt.number?"&#160;":"")}this.stars=this.self.children(this.opt.starType)},_error:function(t){e(this).text(t),e.error(t)},_fill:function(e){for(var i=0,a=1;a<=this.stars.length;a++){var n,r=this.stars[a-1],o=t._turnOn.call(this,a,e);if(this.opt.iconRange&&this.opt.iconRange.length>i){var s=this.opt.iconRange[i];n=t._getRangeIcon.call(this,s,o),a<=s.range&&t._setIcon.call(this,r,n),a===s.range&&i++}else n=this.opt[o?"starOn":"starOff"],t._setIcon.call(this,r,n)}},_getRangeIcon:function(e,t){return t?e.on||this.opt.starOn:e.off||this.opt.starOff},_getScoreByPosition:function(i,a){var n=parseInt(a.alt||a.getAttribute("data-alt"),10);if(this.opt.half){var r=t._getSize.call(this),o=parseFloat((i.pageX-e(a).offset().left)/r);n=this.opt.precision?n-1+o:n-1+(o>.5?1:.5)}return n},_getSize:function(){var e;return e="img"===this.opt.starType?this.stars[0].width:parseFloat(this.stars.eq(0).css("font-size")),e||t._error.call(this,"Could not be possible get the icon size!"),e},_turnOn:function(e,t){return this.opt.single?e===t:t>=e},_getHint:function(e){var t=this.opt.hints[e-1];return""===t?"":t||e},_lock:function(){var e=parseInt(this.score.val(),10),i=e?t._getHint.call(this,e):this.opt.noRatedMsg;this.style.cursor="",this.title=i,this.score.prop("readonly",!0),this.stars.prop("title",i),this.cancel&&this.cancel.hide(),this.self.data("readonly",!0)},_nameForIndex:function(e){return this.opt.score&&this.opt.score>=e?"starOn":"starOff"},_roundStars:function(e){var i=(e%1).toFixed(2);if(i>this.opt.round.down){var a="starOn";this.opt.halfShow&&i<this.opt.round.up?a="starHalf":i<this.opt.round.full&&(a="starOff");var n=this.opt[a],r=this.stars[Math.ceil(e)-1];t._setIcon.call(this,r,n)}},_setIcon:function(e,t){e["img"===this.opt.starType?"src":"className"]=this.opt.path+t},_setTarget:function(e,t){t&&(t=this.opt.targetFormat.toString().replace("{score}",t)),e.is(":input")?e.val(t):e.html(t)},_target:function(i,a){if(this.opt.target){var n=e(this.opt.target);n.length||t._error.call(this,"Target selector invalid or missing!");var r=a&&"mouseover"===a.type;if(void 0===i)i=this.opt.targetText;else if(null===i)i=r?this.opt.cancelHint:this.opt.targetText;else{"hint"===this.opt.targetType?i=t._getHint.call(this,Math.ceil(i)):this.opt.precision&&(i=parseFloat(i).toFixed(1));var o=a&&"mousemove"===a.type;r||o||this.opt.targetKeep||(i=this.opt.targetText)}t._setTarget.call(this,n,i)}},_unlock:function(){this.style.cursor="pointer",this.removeAttribute("title"),this.score.removeAttr("readonly"),this.self.data("readonly",!1);for(var e=0;e<this.opt.number;e++)this.stars[e].title=t._getHint.call(this,e+1);this.cancel&&this.cancel.css("display","")},cancel:function(i){return this.each(function(){var a=e(this);a.data("readonly")!==!0&&(t[i?"click":"score"].call(a,null),this.score.removeAttr("value"))})},click:function(i){return this.each(function(){e(this).data("readonly")!==!0&&(t._apply.call(this,i),this.opt.click&&this.opt.click.call(this,i,e.Event("click")),t._target.call(this,i))})},destroy:function(){return this.each(function(){var t=e(this),i=t.data("raw");i?t.off(".raty").empty().css({cursor:i.style.cursor}).removeData("readonly"):t.data("raw",t.clone()[0])})},getScore:function(){var e,t=[];return this.each(function(){e=this.score.val(),t.push(e?+e:void 0)}),t.length>1?t:t[0]},move:function(i){return this.each(function(){var a=parseInt(i,10),n=e(this).data("options"),r=(+i).toFixed(1).split(".")[1];a>=n.number&&(a=n.number-1,r=10);var o=t._getSize.call(this),s=o/10,l=e(this.stars[a]),c=l.offset().left+s*parseInt(r,10),u=e.Event("mousemove",{pageX:c});l.trigger(u)})},readOnly:function(i){return this.each(function(){var a=e(this);a.data("readonly")!==i&&(i?(a.off(".raty").children("img").off(".raty"),t._lock.call(this)):(t._binds.call(this),t._unlock.call(this)),a.data("readonly",i))})},reload:function(){return t.set.call(this,{})},score:function(){var i=e(this);return arguments.length?t.setScore.apply(i,arguments):t.getScore.call(i)},set:function(t){return this.each(function(){var i=e(this),a=i.data("options"),n=e.extend({},a,t);i.raty(n)})},setScore:function(i){return this.each(function(){e(this).data("readonly")!==!0&&(t._apply.call(this,i),t._target.call(this,i))})}};e.fn.raty=function(i){return t[i]?t[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void e.error("Method "+i+" does not exist!"):t.init.apply(this,arguments)},e.fn.raty.defaults={cancel:!1,cancelClass:"raty-cancel",cancelHint:"Cancel this rating!",cancelOff:"cancel-off.png",cancelOn:"cancel-on.png",cancelPlace:"left",click:void 0,half:!1,halfShow:!0,hints:["bad","poor","regular","good","gorgeous"],iconRange:void 0,mouseout:void 0,mouseover:void 0,noRatedMsg:"Not rated yet!",number:5,numberMax:20,path:void 0,precision:!1,readOnly:!1,round:{down:.25,full:.6,up:.76},score:void 0,scoreName:"score",single:!1,space:!0,starHalf:"star-half.png",starOff:"star-off.png",starOn:"star-on.png",starType:"img",target:void 0,targetFormat:"{score}",targetKeep:!1,targetScore:void 0,targetText:"",targetType:"hint"}}(jQuery),function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";function t(t){return!t.nodeName||-1!==e.inArray(t.nodeName.toLowerCase(),["iframe","#document","html","body"])}function i(t){return e.isFunction(t)||e.isPlainObject(t)?t:{top:t,left:t}}var a=e.scrollTo=function(t,i,a){return e(window).scrollTo(t,i,a)};return a.defaults={axis:"xy",duration:0,limit:!0},e.fn.scrollTo=function(n,r,o){"object"==typeof r&&(o=r,r=0),"function"==typeof o&&(o={onAfter:o}),"max"===n&&(n=9e9),o=e.extend({},a.defaults,o),r=r||o.duration;var s=o.queue&&o.axis.length>1;return s&&(r/=2),o.offset=i(o.offset),o.over=i(o.over),this.each(function(){function l(t){var i=e.extend({},o,{queue:!0,duration:r,complete:t&&function(){t.call(d,p,o)}});h.animate(f,i)}if(null!==n){var c,u=t(this),d=u?this.contentWindow||window:this,h=e(d),p=n,f={};switch(typeof p){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?#x2F;.test(p)){p=i(p);break}if(p=u?e(p):e(p,d),!p.length)return;case"object":(p.is||p.style)&&(c=(p=e(p)).offset())}var m=e.isFunction(o.offset)&&o.offset(d,p)||o.offset;e.each(o.axis.split(""),function(e,t){var i="x"===t?"Left":"Top",n=i.toLowerCase(),r="scroll"+i,g=h[r](),v=a.max(d,t);if(c)f[r]=c[n]+(u?0:g-h.offset()[n]),o.margin&&(f[r]-=parseInt(p.css("margin"+i),10)||0,f[r]-=parseInt(p.css("border"+i+"Width"),10)||0),f[r]+=m[n]||0,o.over[n]&&(f[r]+=p["x"===t?"width":"height"]()*o.over[n]);else{var y=p[n];f[r]=y.slice&&"%"===y.slice(-1)?parseFloat(y)/100*v:y}o.limit&&/^\d+#x2F;.test(f[r])&&(f[r]=f[r]<=0?0:Math.min(f[r],v)),!e&&o.axis.length>1&&(g===f[r]?f={}:s&&(l(o.onAfterFirst),f={}))}),l(o.onAfter)}})},a.max=function(i,a){var n="x"===a?"Width":"Height",r="scroll"+n;if(!t(i))return i[r]-e(i)[n.toLowerCase()]();var o="client"+n,s=i.ownerDocument||i.document,l=s.documentElement,c=s.body;return Math.max(l[r],c[r])-Math.min(l[o],c[o])},e.Tween.propHooks.scrollLeft=e.Tween.propHooks.scrollTop={get:function(t){return e(t.elem)[t.prop]()},set:function(t){var i=this.get(t);if(t.options.interrupt&&t._last&&t._last!==i)return e(t.elem).stop();var a=Math.round(t.now);i!==a&&(e(t.elem)[t.prop](a),t._last=this.get(t))}},a}),!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var o=t||window.event,s=l.call(arguments,1),c=0,d=0,h=0,p=0,f=0,m=0;if(t=e.event.fix(o),t.type="mousewheel","detail"in o&&(h=-1*o.detail),"wheelDelta"in o&&(h=o.wheelDelta),"wheelDeltaY"in o&&(h=o.wheelDeltaY),"wheelDeltaX"in o&&(d=-1*o.wheelDeltaX),"axis"in o&&o.axis===o.HORIZONTAL_AXIS&&(d=-1*h,h=0),c=0===h?d:h,"deltaY"in o&&(h=-1*o.deltaY,c=h),"deltaX"in o&&(d=o.deltaX,0===h&&(c=-1*d)),0!==h||0!==d){if(1===o.deltaMode){var g=e.data(this,"mousewheel-line-height");c*=g,h*=g,d*=g}else if(2===o.deltaMode){var v=e.data(this,"mousewheel-page-height");c*=v,h*=v,d*=v}if(p=Math.max(Math.abs(h),Math.abs(d)),(!r||r>p)&&(r=p,a(o,p)&&(r/=40)),a(o,p)&&(c/=40,d/=40,h/=40),c=Math[c>=1?"floor":"ceil"](c/r),d=Math[d>=1?"floor":"ceil"](d/r),h=Math[h>=1?"floor":"ceil"](h/r),u.settings.normalizeOffset&&this.getBoundingClientRect){var y=this.getBoundingClientRect();f=t.clientX-y.left,m=t.clientY-y.top}return t.deltaX=d,t.deltaY=h,t.deltaFactor=r,t.offsetX=f,t.offsetY=m,t.deltaMode=0,s.unshift(t,c,d,h),n&&clearTimeout(n),n=setTimeout(i,200),(e.event.dispatch||e.event.handle).apply(this,s)}}function i(){r=null}function a(e,t){return u.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120===0}var n,r,o=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],s="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],l=Array.prototype.slice;if(e.event.fixHooks)for(var c=o.length;c;)e.event.fixHooks[o[--c]]=e.event.mouseHooks;var u=e.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var i=s.length;i;)this.addEventListener(s[--i],t,!1);else this.onmousewheel=t;e.data(this,"mousewheel-line-height",u.getLineHeight(this)),e.data(this,"mousewheel-page-height",u.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var i=s.length;i;)this.removeEventListener(s[--i],t,!1);else this.onmousewheel=null;e.removeData(this,"mousewheel-line-height"),e.removeData(this,"mousewheel-page-height")},getLineHeight:function(t){var i=e(t),a=i["offsetParent"in e.fn?"offsetParent":"parent"]();return a.length||(a=e("body")),parseInt(a.css("fontSize"),10)||parseInt(i.css("fontSize"),10)||16},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),!function(e){"undefined"!=typeof module&&module.exports?module.exports=e:e(jQuery,window,document)}(function(e){!function(t){var i="function"==typeof define&&define.amd,a="undefined"!=typeof module&&module.exports,n="https:"==document.location.protocol?"https:":"http:",r="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js";i||(a?require("jquery-mousewheel")(e):e.event.special.mousewheel||e("head").append(decodeURI("%3Cscript src="+n+"//"+r+"%3E%3C/script%3E"))),t()}(function(){var t,i="mCustomScrollbar",a="mCS",n=".mCustomScrollbar",r={setTop:0,setLeft:0,axis:"y",scrollbarPosition:"inside",scrollInertia:950,autoDraggerLength:!0,alwaysShowScrollbar:0,snapOffset:0,mouseWheel:{enable:!0,scrollAmount:"auto",axis:"y",deltaFactor:"auto",disableOver:["select","option","keygen","datalist","textarea"]},scrollButtons:{scrollType:"stepless",scrollAmount:"auto"},keyboard:{enable:!0,scrollType:"stepless",scrollAmount:"auto"},contentTouchScroll:25,advanced:{autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",updateOnContentResize:!0,updateOnImageLoad:!0},theme:"light",callbacks:{onTotalScrollOffset:0,onTotalScrollBackOffset:0,alwaysTriggerOffsets:!0}},o=0,s={},l=window.attachEvent&&!window.addEventListener?1:0,c=!1,u=["mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar","mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer","mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft","mCSB_buttonRight"],d={init:function(t){var t=e.extend(!0,{},r,t),i=h.call(this);if(t.live){var l=t.liveSelector||this.selector||n,c=e(l);if("off"===t.live)return void f(l);s[l]=setTimeout(function(){c.mCustomScrollbar(t),"once"===t.live&&c.length&&f(l)},500)}else f(l);return t.setWidth=t.set_width?t.set_width:t.setWidth,t.setHeight=t.set_height?t.set_height:t.setHeight,t.axis=t.horizontalScroll?"x":m(t.axis),t.scrollInertia=t.scrollInertia>0&&t.scrollInertia<17?17:t.scrollInertia,"object"!=typeof t.mouseWheel&&1==t.mouseWheel&&(t.mouseWheel={enable:!0,scrollAmount:"auto",axis:"y",preventDefault:!1,deltaFactor:"auto",normalizeDelta:!1,invert:!1}),t.mouseWheel.scrollAmount=t.mouseWheelPixels?t.mouseWheelPixels:t.mouseWheel.scrollAmount,t.mouseWheel.normalizeDelta=t.advanced.normalizeMouseWheelDelta?t.advanced.normalizeMouseWheelDelta:t.mouseWheel.normalizeDelta,t.scrollButtons.scrollType=g(t.scrollButtons.scrollType),p(t),e(i).each(function(){var i=e(this);if(!i.data(a)){i.data(a,{idx:++o,opt:t,scrollRatio:{y:null,x:null},overflowed:null,contentReset:{y:null,x:null},bindEvents:!1,tweenRunning:!1,sequential:{},langDir:i.css("direction"),cbOffsets:null,trigger:null});var n=i.data(a),r=n.opt,s=i.data("mcs-axis"),l=i.data("mcs-scrollbar-position"),c=i.data("mcs-theme");s&&(r.axis=s),l&&(r.scrollbarPosition=l),c&&(r.theme=c,p(r)),v.call(this),e("#mCSB_"+n.idx+"_container img:not(."+u[2]+")").addClass(u[2]),d.update.call(null,i)}})},update:function(t,i){var n=t||h.call(this);return e(n).each(function(){var t=e(this);if(t.data(a)){var n=t.data(a),r=n.opt,o=e("#mCSB_"+n.idx+"_container"),s=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];if(!o.length)return;n.tweenRunning&&Y(t),t.hasClass(u[3])&&t.removeClass(u[3]),t.hasClass(u[4])&&t.removeClass(u[4]),x.call(this),b.call(this),"y"===r.axis||r.advanced.autoExpandHorizontalScroll||o.css("width",y(o.children())),n.overflowed=j.call(this),D.call(this),r.autoDraggerLength&&_.call(this),C.call(this),Q.call(this);var l=[Math.abs(o[0].offsetTop),Math.abs(o[0].offsetLeft)];"x"!==r.axis&&(n.overflowed[0]?s[0].height()>s[0].parent().height()?k.call(this):(X(t,l[0].toString(),{dir:"y",dur:0,overwrite:"none"}),n.contentReset.y=null):(k.call(this),"y"===r.axis?T.call(this):"yx"===r.axis&&n.overflowed[1]&&X(t,l[1].toString(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==r.axis&&(n.overflowed[1]?s[1].width()>s[1].parent().width()?k.call(this):(X(t,l[1].toString(),{dir:"x",dur:0,overwrite:"none"}),n.contentReset.x=null):(k.call(this),"x"===r.axis?T.call(this):"yx"===r.axis&&n.overflowed[0]&&X(t,l[0].toString(),{dir:"y",dur:0,overwrite:"none"}))),i&&n&&(2===i&&r.callbacks.onImageLoad&&"function"==typeof r.callbacks.onImageLoad?r.callbacks.onImageLoad.call(this):3===i&&r.callbacks.onSelectorChange&&"function"==typeof r.callbacks.onSelectorChange?r.callbacks.onSelectorChange.call(this):r.callbacks.onUpdate&&"function"==typeof r.callbacks.onUpdate&&r.callbacks.onUpdate.call(this)),U.call(this)}})},scrollTo:function(t,i){if("undefined"!=typeof t&&null!=t){var n=h.call(this);return e(n).each(function(){var n=e(this);if(n.data(a)){var r=n.data(a),o=r.opt,s={trigger:"external",scrollInertia:o.scrollInertia,scrollEasing:"mcsEaseInOut",moveDragger:!1,timeout:60,callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},l=e.extend(!0,{},s,i),c=z.call(this,t),u=l.scrollInertia>0&&l.scrollInertia<17?17:l.scrollInertia;c[0]=N.call(this,c[0],"y"),c[1]=N.call(this,c[1],"x"),l.moveDragger&&(c[0]*=r.scrollRatio.y,c[1]*=r.scrollRatio.x),l.dur=u,setTimeout(function(){null!==c[0]&&"undefined"!=typeof c[0]&&"x"!==o.axis&&r.overflowed[0]&&(l.dir="y",l.overwrite="all",X(n,c[0].toString(),l)),null!==c[1]&&"undefined"!=typeof c[1]&&"y"!==o.axis&&r.overflowed[1]&&(l.dir="x",l.overwrite="none",X(n,c[1].toString(),l))},l.timeout)}})}},stop:function(){var t=h.call(this);return e(t).each(function(){var t=e(this);t.data(a)&&Y(t)})},disable:function(t){var i=h.call(this);return e(i).each(function(){var i=e(this);i.data(a)&&(i.data(a),U.call(this,"remove"),T.call(this),t&&k.call(this),D.call(this,!0),i.addClass(u[3]))})},destroy:function(){var t=h.call(this);return e(t).each(function(){var n=e(this);if(n.data(a)){var r=n.data(a),o=r.opt,s=e("#mCSB_"+r.idx),l=e("#mCSB_"+r.idx+"_container"),c=e(".mCSB_"+r.idx+"_scrollbar");o.live&&f(o.liveSelector||e(t).selector),U.call(this,"remove"),T.call(this),k.call(this),n.removeData(a),Z(this,"mcs"),c.remove(),l.find("img."+u[2]).removeClass(u[2]),s.replaceWith(l.contents()),n.removeClass(i+" _"+a+"_"+r.idx+" "+u[6]+" "+u[7]+" "+u[5]+" "+u[3]).addClass(u[4])}})}},h=function(){return"object"!=typeof e(this)||e(this).length<1?n:this},p=function(t){var i=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"],a=["rounded-dots","rounded-dots-dark","3d","3d-dark","3d-thick","3d-thick-dark","inset","inset-dark","inset-2","inset-2-dark","inset-3","inset-3-dark"],n=["minimal","minimal-dark"],r=["minimal","minimal-dark"],o=["minimal","minimal-dark"];t.autoDraggerLength=e.inArray(t.theme,i)>-1?!1:t.autoDraggerLength,t.autoExpandScrollbar=e.inArray(t.theme,a)>-1?!1:t.autoExpandScrollbar,t.scrollButtons.enable=e.inArray(t.theme,n)>-1?!1:t.scrollButtons.enable,t.autoHideScrollbar=e.inArray(t.theme,r)>-1?!0:t.autoHideScrollbar,t.scrollbarPosition=e.inArray(t.theme,o)>-1?"outside":t.scrollbarPosition},f=function(e){s[e]&&(clearTimeout(s[e]),Z(s,e))},m=function(e){return"yx"===e||"xy"===e||"auto"===e?"yx":"x"===e||"horizontal"===e?"x":"y"},g=function(e){return"stepped"===e||"pixels"===e||"step"===e||"click"===e?"stepped":"stepless"},v=function(){var t=e(this),n=t.data(a),r=n.opt,o=r.autoExpandScrollbar?" "+u[1]+"_expand":"",s=["<div id='mCSB_"+n.idx+"_scrollbar_vertical' class='mCSB_scrollTools mCSB_"+n.idx+"_scrollbar mCS-"+r.theme+" mCSB_scrollTools_vertical"+o+"'><div class='"+u[12]+"'><div id='mCSB_"+n.idx+"_dragger_vertical' class='mCSB_dragger' style='position:absolute;' oncontextmenu='return false;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>","<div id='mCSB_"+n.idx+"_scrollbar_horizontal' class='mCSB_scrollTools mCSB_"+n.idx+"_scrollbar mCS-"+r.theme+" mCSB_scrollTools_horizontal"+o+"'><div class='"+u[12]+"'><div id='mCSB_"+n.idx+"_dragger_horizontal' class='mCSB_dragger' style='position:absolute;' oncontextmenu='return false;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>"],l="yx"===r.axis?"mCSB_vertical_horizontal":"x"===r.axis?"mCSB_horizontal":"mCSB_vertical",c="yx"===r.axis?s[0]+s[1]:"x"===r.axis?s[1]:s[0],d="yx"===r.axis?"<div id='mCSB_"+n.idx+"_container_wrapper' class='mCSB_container_wrapper' />":"",h=r.autoHideScrollbar?" "+u[6]:"",p="x"!==r.axis&&"rtl"===n.langDir?" "+u[7]:"";r.setWidth&&t.css("width",r.setWidth),r.setHeight&&t.css("height",r.setHeight),r.setLeft="y"!==r.axis&&"rtl"===n.langDir?"989999px":r.setLeft,t.addClass(i+" _"+a+"_"+n.idx+h+p).wrapInner("<div id='mCSB_"+n.idx+"' class='mCustomScrollBox mCS-"+r.theme+" "+l+"'><div id='mCSB_"+n.idx+"_container' class='mCSB_container' style='position:relative; top:"+r.setTop+"; left:"+r.setLeft+";' dir="+n.langDir+" /></div>");
6
var f=e("#mCSB_"+n.idx),m=e("#mCSB_"+n.idx+"_container");"y"===r.axis||r.advanced.autoExpandHorizontalScroll||m.css("width",y(m.children())),"outside"===r.scrollbarPosition?("static"===t.css("position")&&t.css("position","relative"),t.css("overflow","visible"),f.addClass("mCSB_outside").after(c)):(f.addClass("mCSB_inside").append(c),m.wrap(d)),w.call(this);var g=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];g[0].css("min-height",g[0].height()),g[1].css("min-width",g[1].width())},y=function(t){return Math.max.apply(Math,t.map(function(){return e(this).outerWidth(!0)}).get())},b=function(){var t=e(this),i=t.data(a),n=i.opt,r=e("#mCSB_"+i.idx+"_container");n.advanced.autoExpandHorizontalScroll&&"y"!==n.axis&&r.css({position:"absolute",width:"auto"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({width:Math.ceil(r[0].getBoundingClientRect().right+.4)-Math.floor(r[0].getBoundingClientRect().left),position:"relative"}).unwrap()},w=function(){var t=e(this),i=t.data(a),n=i.opt,r=e(".mCSB_"+i.idx+"_scrollbar:first"),o=te(n.scrollButtons.tabindex)?"tabindex='"+n.scrollButtons.tabindex+"'":"",s=["<a href='#' class='"+u[13]+"' oncontextmenu='return false;' "+o+" />","<a href='#' class='"+u[14]+"' oncontextmenu='return false;' "+o+" />","<a href='#' class='"+u[15]+"' oncontextmenu='return false;' "+o+" />","<a href='#' class='"+u[16]+"' oncontextmenu='return false;' "+o+" />"],l=["x"===n.axis?s[2]:s[0],"x"===n.axis?s[3]:s[1],s[2],s[3]];n.scrollButtons.enable&&r.prepend(l[0]).append(l[1]).next(".mCSB_scrollTools").prepend(l[2]).append(l[3])},x=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=t.css("max-height")||"none",o=-1!==r.indexOf("%"),s=t.css("box-sizing");if("none"!==r){var l=o?t.parent().height()*parseInt(r)/100:parseInt(r);"border-box"===s&&(l-=t.innerHeight()-t.height()+(t.outerHeight()-t.innerHeight())),n.css("max-height",Math.round(l))}},_=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=e("#mCSB_"+i.idx+"_container"),o=[e("#mCSB_"+i.idx+"_dragger_vertical"),e("#mCSB_"+i.idx+"_dragger_horizontal")],s=[n.height()/r.outerHeight(!1),n.width()/r.outerWidth(!1)],c=[parseInt(o[0].css("min-height")),Math.round(s[0]*o[0].parent().height()),parseInt(o[1].css("min-width")),Math.round(s[1]*o[1].parent().width())],u=l&&c[1]<c[0]?c[0]:c[1],d=l&&c[3]<c[2]?c[2]:c[3];o[0].css({height:u,"max-height":o[0].parent().height()-10}).find(".mCSB_dragger_bar").css({"line-height":c[0]+"px"}),o[1].css({width:d,"max-width":o[1].parent().width()-10})},C=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=e("#mCSB_"+i.idx+"_container"),o=[e("#mCSB_"+i.idx+"_dragger_vertical"),e("#mCSB_"+i.idx+"_dragger_horizontal")],s=[r.outerHeight(!1)-n.height(),r.outerWidth(!1)-n.width()],l=[s[0]/(o[0].parent().height()-o[0].height()),s[1]/(o[1].parent().width()-o[1].width())];i.scrollRatio={y:l[0],x:l[1]}},S=function(e,t,i){var a=i?u[0]+"_expanded":"",n=e.closest(".mCSB_scrollTools");"active"===t?(e.toggleClass(u[0]+" "+a),n.toggleClass(u[1]),e[0]._draggable=e[0]._draggable?0:1):e[0]._draggable||("hide"===t?(e.removeClass(u[0]),n.removeClass(u[1])):(e.addClass(u[0]),n.addClass(u[1])))},j=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=e("#mCSB_"+i.idx+"_container"),o=null==i.overflowed?r.height():r.outerHeight(!1),s=null==i.overflowed?r.width():r.outerWidth(!1);return[o>n.height(),s>n.width()]},k=function(){var t=e(this),i=t.data(a),n=i.opt,r=e("#mCSB_"+i.idx),o=e("#mCSB_"+i.idx+"_container"),s=[e("#mCSB_"+i.idx+"_dragger_vertical"),e("#mCSB_"+i.idx+"_dragger_horizontal")];if(Y(t),("x"!==n.axis&&!i.overflowed[0]||"y"===n.axis&&i.overflowed[0])&&(s[0].add(o).css("top",0),X(t,"_resetY")),"y"!==n.axis&&!i.overflowed[1]||"x"===n.axis&&i.overflowed[1]){var l=dx=0;"rtl"===i.langDir&&(l=r.width()-o.outerWidth(!1),dx=Math.abs(l/i.scrollRatio.x)),o.css("left",l),s[1].css("left",dx),X(t,"_resetX")}},Q=function(){function t(){o=setTimeout(function(){e.event.special.mousewheel?(clearTimeout(o),A.call(i[0])):t()},100)}var i=e(this),n=i.data(a),r=n.opt;if(!n.bindEvents){if(E.call(this),r.contentTouchScroll&&M.call(this),I.call(this),r.mouseWheel.enable){var o;t()}H.call(this),L.call(this),r.advanced.autoScrollOnFocus&&F.call(this),r.scrollButtons.enable&&B.call(this),r.keyboard.enable&&W.call(this),n.bindEvents=!0}},T=function(){var t=e(this),i=t.data(a),n=i.opt,r=a+"_"+i.idx,o=".mCSB_"+i.idx+"_scrollbar",s=e("#mCSB_"+i.idx+",#mCSB_"+i.idx+"_container,#mCSB_"+i.idx+"_container_wrapper,"+o+" ."+u[12]+",#mCSB_"+i.idx+"_dragger_vertical,#mCSB_"+i.idx+"_dragger_horizontal,"+o+">a"),l=e("#mCSB_"+i.idx+"_container");n.advanced.releaseDraggableSelectors&&s.add(e(n.advanced.releaseDraggableSelectors)),i.bindEvents&&(e(document).unbind("."+r),s.each(function(){e(this).unbind("."+r)}),clearTimeout(t[0]._focusTimeout),Z(t[0],"_focusTimeout"),clearTimeout(i.sequential.step),Z(i.sequential,"step"),clearTimeout(l[0].onCompleteTimeout),Z(l[0],"onCompleteTimeout"),i.bindEvents=!1)},D=function(t){var i=e(this),n=i.data(a),r=n.opt,o=e("#mCSB_"+n.idx+"_container_wrapper"),s=o.length?o:e("#mCSB_"+n.idx+"_container"),l=[e("#mCSB_"+n.idx+"_scrollbar_vertical"),e("#mCSB_"+n.idx+"_scrollbar_horizontal")],c=[l[0].find(".mCSB_dragger"),l[1].find(".mCSB_dragger")];"x"!==r.axis&&(n.overflowed[0]&&!t?(l[0].add(c[0]).add(l[0].children("a")).css("display","block"),s.removeClass(u[8]+" "+u[10])):(r.alwaysShowScrollbar?(2!==r.alwaysShowScrollbar&&c[0].css("display","none"),s.removeClass(u[10])):(l[0].css("display","none"),s.addClass(u[10])),s.addClass(u[8]))),"y"!==r.axis&&(n.overflowed[1]&&!t?(l[1].add(c[1]).add(l[1].children("a")).css("display","block"),s.removeClass(u[9]+" "+u[11])):(r.alwaysShowScrollbar?(2!==r.alwaysShowScrollbar&&c[1].css("display","none"),s.removeClass(u[11])):(l[1].css("display","none"),s.addClass(u[11])),s.addClass(u[9]))),n.overflowed[0]||n.overflowed[1]?i.removeClass(u[5]):i.addClass(u[5])},O=function(e){var t=e.type;switch(t){case"pointerdown":case"MSPointerDown":case"pointermove":case"MSPointerMove":case"pointerup":case"MSPointerUp":return e.target.ownerDocument!==document?[e.originalEvent.screenY,e.originalEvent.screenX,!1]:[e.originalEvent.pageY,e.originalEvent.pageX,!1];case"touchstart":case"touchmove":case"touchend":var i=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],a=e.originalEvent.touches.length||e.originalEvent.changedTouches.length;return e.target.ownerDocument!==document?[i.screenY,i.screenX,a>1]:[i.pageY,i.pageX,a>1];default:return[e.pageY,e.pageX,!1]}},E=function(){function t(e){var t=f.find("iframe");if(t.length){var i=e?"auto":"none";t.css("pointer-events",i)}}function i(e,t,i,a){if(f[0].idleTimer=d.scrollInertia<233?250:0,n.attr("id")===p[1])var r="x",o=(n[0].offsetLeft-t+a)*u.scrollRatio.x;else var r="y",o=(n[0].offsetTop-e+i)*u.scrollRatio.y;X(s,o.toString(),{dir:r,drag:!0})}var n,r,o,s=e(this),u=s.data(a),d=u.opt,h=a+"_"+u.idx,p=["mCSB_"+u.idx+"_dragger_vertical","mCSB_"+u.idx+"_dragger_horizontal"],f=e("#mCSB_"+u.idx+"_container"),m=e("#"+p[0]+",#"+p[1]),g=d.advanced.releaseDraggableSelectors?m.add(e(d.advanced.releaseDraggableSelectors)):m;m.bind("mousedown."+h+" touchstart."+h+" pointerdown."+h+" MSPointerDown."+h,function(i){if(i.stopImmediatePropagation(),i.preventDefault(),J(i)){c=!0,l&&(document.onselectstart=function(){return!1}),t(!1),Y(s),n=e(this);var a=n.offset(),u=O(i)[0]-a.top,h=O(i)[1]-a.left,p=n.height()+a.top,f=n.width()+a.left;p>u&&u>0&&f>h&&h>0&&(r=u,o=h),S(n,"active",d.autoExpandScrollbar)}}).bind("touchmove."+h,function(e){e.stopImmediatePropagation(),e.preventDefault();var t=n.offset(),a=O(e)[0]-t.top,s=O(e)[1]-t.left;i(r,o,a,s)}),e(document).bind("mousemove."+h+" pointermove."+h+" MSPointerMove."+h,function(e){if(n){var t=n.offset(),a=O(e)[0]-t.top,s=O(e)[1]-t.left;if(r===a)return;i(r,o,a,s)}}).add(g).bind("mouseup."+h+" touchend."+h+" pointerup."+h+" MSPointerUp."+h,function(){n&&(S(n,"active",d.autoExpandScrollbar),n=null),c=!1,l&&(document.onselectstart=null),t(!0)})},M=function(){function i(e){if(!ee(e)||c||O(e)[2])return void(t=0);t=1,x=0,_=0;var i=T.offset();u=O(e)[0]-i.top,d=O(e)[1]-i.left,R=[O(e)[0],O(e)[1]]}function n(e){if(ee(e)&&!c&&!O(e)[2]&&(e.stopImmediatePropagation(),!_||x)){m=G();var t=Q.offset(),i=O(e)[0]-t.top,a=O(e)[1]-t.left,n="mcsLinearOut";if(E.push(i),M.push(a),R[2]=Math.abs(O(e)[0]-R[0]),R[3]=Math.abs(O(e)[1]-R[1]),S.overflowed[0])var r=D[0].parent().height()-D[0].height(),o=u-i>0&&i-u>-(r*S.scrollRatio.y)&&(2*R[3]<R[2]||"yx"===j.axis);if(S.overflowed[1])var s=D[1].parent().width()-D[1].width(),h=d-a>0&&a-d>-(s*S.scrollRatio.x)&&(2*R[2]<R[3]||"yx"===j.axis);o||h?(e.preventDefault(),x=1):_=1,b="yx"===j.axis?[u-i,d-a]:"x"===j.axis?[null,d-a]:[u-i,null],T[0].idleTimer=250,S.overflowed[0]&&l(b[0],I,n,"y","all",!0),S.overflowed[1]&&l(b[1],I,n,"x",A,!0)}}function r(e){if(!ee(e)||c||O(e)[2])return void(t=0);t=1,e.stopImmediatePropagation(),Y(C),f=G();var i=Q.offset();h=O(e)[0]-i.top,p=O(e)[1]-i.left,E=[],M=[]}function o(e){if(ee(e)&&!c&&!O(e)[2]){e.stopImmediatePropagation(),x=0,_=0,g=G();var t=Q.offset(),i=O(e)[0]-t.top,a=O(e)[1]-t.left;if(!(g-m>30)){y=1e3/(g-f);var n="mcsEaseOut",r=2.5>y,o=r?[E[E.length-2],M[M.length-2]]:[0,0];v=r?[i-o[0],a-o[1]]:[i-h,a-p];var u=[Math.abs(v[0]),Math.abs(v[1])];y=r?[Math.abs(v[0]/4),Math.abs(v[1]/4)]:[y,y];var d=[Math.abs(T[0].offsetTop)-v[0]*s(u[0]/y[0],y[0]),Math.abs(T[0].offsetLeft)-v[1]*s(u[1]/y[1],y[1])];b="yx"===j.axis?[d[0],d[1]]:"x"===j.axis?[null,d[1]]:[d[0],null],w=[4*u[0]+j.scrollInertia,4*u[1]+j.scrollInertia];var C=parseInt(j.contentTouchScroll)||0;b[0]=u[0]>C?b[0]:0,b[1]=u[1]>C?b[1]:0,S.overflowed[0]&&l(b[0],w[0],n,"y",A,!1),S.overflowed[1]&&l(b[1],w[1],n,"x",A,!1)}}}function s(e,t){var i=[1.5*t,2*t,t/1.5,t/2];return e>90?t>4?i[0]:i[3]:e>60?t>3?i[3]:i[2]:e>30?t>8?i[1]:t>6?i[0]:t>4?t:i[2]:t>8?t:i[3]}function l(e,t,i,a,n,r){e&&X(C,e.toString(),{dur:t,scrollEasing:i,dir:a,overwrite:n,drag:r})}var u,d,h,p,f,m,g,v,y,b,w,x,_,C=e(this),S=C.data(a),j=S.opt,k=a+"_"+S.idx,Q=e("#mCSB_"+S.idx),T=e("#mCSB_"+S.idx+"_container"),D=[e("#mCSB_"+S.idx+"_dragger_vertical"),e("#mCSB_"+S.idx+"_dragger_horizontal")],E=[],M=[],I=0,A="yx"===j.axis?"none":"all",R=[],H=T.find("iframe"),F=["touchstart."+k+" pointerdown."+k+" MSPointerDown."+k,"touchmove."+k+" pointermove."+k+" MSPointerMove."+k,"touchend."+k+" pointerup."+k+" MSPointerUp."+k];T.bind(F[0],function(e){i(e)}).bind(F[1],function(e){n(e)}),Q.bind(F[0],function(e){r(e)}).bind(F[2],function(e){o(e)}),H.length&&H.each(function(){e(this).load(function(){P(this)&&e(this.contentDocument||this.contentWindow.document).bind(F[0],function(e){i(e),r(e)}).bind(F[1],function(e){n(e)}).bind(F[2],function(e){o(e)})})})},I=function(){function i(){return window.getSelection?window.getSelection().toString():document.selection&&"Control"!=document.selection.type?document.selection.createRange().text:0}function n(e,t,i){u.type=i&&r?"stepped":"stepless",u.scrollAmount=10,$(o,e,t,"mcsLinearOut",i?60:null)}var r,o=e(this),s=o.data(a),l=s.opt,u=s.sequential,d=a+"_"+s.idx,h=e("#mCSB_"+s.idx+"_container"),p=h.parent();h.bind("mousedown."+d,function(){t||r||(r=1,c=!0)}).add(document).bind("mousemove."+d,function(e){if(!t&&r&&i()){var a=h.offset(),o=O(e)[0]-a.top+h[0].offsetTop,c=O(e)[1]-a.left+h[0].offsetLeft;o>0&&o<p.height()&&c>0&&c<p.width()?u.step&&n("off",null,"stepped"):("x"!==l.axis&&s.overflowed[0]&&(0>o?n("on",38):o>p.height()&&n("on",40)),"y"!==l.axis&&s.overflowed[1]&&(0>c?n("on",37):c>p.width()&&n("on",39)))}}).bind("mouseup."+d,function(){t||(r&&(r=0,n("off",null)),c=!1)})},A=function(){function t(t,a){if(Y(i),!R(i,t.target)){var o="auto"!==r.mouseWheel.deltaFactor?parseInt(r.mouseWheel.deltaFactor):l&&t.deltaFactor<100?100:t.deltaFactor||100;if("x"===r.axis||"x"===r.mouseWheel.axis)var u="x",d=[Math.round(o*n.scrollRatio.x),parseInt(r.mouseWheel.scrollAmount)],h="auto"!==r.mouseWheel.scrollAmount?d[1]:d[0]>=s.width()?.9*s.width():d[0],p=Math.abs(e("#mCSB_"+n.idx+"_container")[0].offsetLeft),f=c[1][0].offsetLeft,m=c[1].parent().width()-c[1].width(),g=t.deltaX||t.deltaY||a;else var u="y",d=[Math.round(o*n.scrollRatio.y),parseInt(r.mouseWheel.scrollAmount)],h="auto"!==r.mouseWheel.scrollAmount?d[1]:d[0]>=s.height()?.9*s.height():d[0],p=Math.abs(e("#mCSB_"+n.idx+"_container")[0].offsetTop),f=c[0][0].offsetTop,m=c[0].parent().height()-c[0].height(),g=t.deltaY||a;"y"===u&&!n.overflowed[0]||"x"===u&&!n.overflowed[1]||(r.mouseWheel.invert&&(g=-g),r.mouseWheel.normalizeDelta&&(g=0>g?-1:1),(g>0&&0!==f||0>g&&f!==m||r.mouseWheel.preventDefault)&&(t.stopImmediatePropagation(),t.preventDefault()),X(i,(p-g*h).toString(),{dir:u}))}}var i=e(this),n=i.data(a),r=n.opt,o=a+"_"+n.idx,s=e("#mCSB_"+n.idx),c=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")],u=e("#mCSB_"+n.idx+"_container").find("iframe");n&&(u.length&&u.each(function(){e(this).load(function(){P(this)&&e(this.contentDocument||this.contentWindow.document).bind("mousewheel."+o,function(e,i){t(e,i)})})}),s.bind("mousewheel."+o,function(e,i){t(e,i)}))},P=function(e){var t=null;try{var i=e.contentDocument||e.contentWindow.document;t=i.body.innerHTML}catch(a){}return null!==t},R=function(t,i){var n=i.nodeName.toLowerCase(),r=t.data(a).opt.mouseWheel.disableOver,o=["select","textarea"];return e.inArray(n,r)>-1&&!(e.inArray(n,o)>-1&&!e(i).is(":focus"))},H=function(){var t=e(this),i=t.data(a),n=a+"_"+i.idx,r=e("#mCSB_"+i.idx+"_container"),o=r.parent(),s=e(".mCSB_"+i.idx+"_scrollbar ."+u[12]);s.bind("touchstart."+n+" pointerdown."+n+" MSPointerDown."+n,function(){c=!0}).bind("touchend."+n+" pointerup."+n+" MSPointerUp."+n,function(){c=!1}).bind("click."+n,function(a){if(e(a.target).hasClass(u[12])||e(a.target).hasClass("mCSB_draggerRail")){Y(t);var n=e(this),s=n.find(".mCSB_dragger");if(n.parent(".mCSB_scrollTools_horizontal").length>0){if(!i.overflowed[1])return;var l="x",c=a.pageX>s.offset().left?-1:1,d=Math.abs(r[0].offsetLeft)-.9*c*o.width()}else{if(!i.overflowed[0])return;var l="y",c=a.pageY>s.offset().top?-1:1,d=Math.abs(r[0].offsetTop)-.9*c*o.height()}X(t,d.toString(),{dir:l,scrollEasing:"mcsEaseInOut"})}})},F=function(){var t=e(this),i=t.data(a),n=i.opt,r=a+"_"+i.idx,o=e("#mCSB_"+i.idx+"_container"),s=o.parent();o.bind("focusin."+r,function(){var i=e(document.activeElement),a=o.find(".mCustomScrollBox").length,r=0;i.is(n.advanced.autoScrollOnFocus)&&(Y(t),clearTimeout(t[0]._focusTimeout),t[0]._focusTimer=a?(r+17)*a:0,t[0]._focusTimeout=setTimeout(function(){var e=[ie(i)[0],ie(i)[1]],a=[o[0].offsetTop,o[0].offsetLeft],l=[a[0]+e[0]>=0&&a[0]+e[0]<s.height()-i.outerHeight(!1),a[1]+e[1]>=0&&a[0]+e[1]<s.width()-i.outerWidth(!1)],c="yx"!==n.axis||l[0]||l[1]?"all":"none";"x"===n.axis||l[0]||X(t,e[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:c,dur:r}),"y"===n.axis||l[1]||X(t,e[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:c,dur:r})},t[0]._focusTimer))})},L=function(){var t=e(this),i=t.data(a),n=a+"_"+i.idx,r=e("#mCSB_"+i.idx+"_container").parent();r.bind("scroll."+n,function(){(0!==r.scrollTop()||0!==r.scrollLeft())&&e(".mCSB_"+i.idx+"_scrollbar").css("visibility","hidden")})},B=function(){var t=e(this),i=t.data(a),n=i.opt,r=i.sequential,o=a+"_"+i.idx,s=".mCSB_"+i.idx+"_scrollbar",l=e(s+">a");l.bind("mousedown."+o+" touchstart."+o+" pointerdown."+o+" MSPointerDown."+o+" mouseup."+o+" touchend."+o+" pointerup."+o+" MSPointerUp."+o+" mouseout."+o+" pointerout."+o+" MSPointerOut."+o+" click."+o,function(a){function o(e,i){r.scrollAmount=n.snapAmount||n.scrollButtons.scrollAmount,$(t,e,i)}if(a.preventDefault(),J(a)){var s=e(this).attr("class");switch(r.type=n.scrollButtons.scrollType,a.type){case"mousedown":case"touchstart":case"pointerdown":case"MSPointerDown":if("stepped"===r.type)return;c=!0,i.tweenRunning=!1,o("on",s);break;case"mouseup":case"touchend":case"pointerup":case"MSPointerUp":case"mouseout":case"pointerout":case"MSPointerOut":if("stepped"===r.type)return;c=!1,r.dir&&o("off",s);break;case"click":if("stepped"!==r.type||i.tweenRunning)return;o("on",s)}}})},W=function(){function t(t){function a(e,t){o.type=r.keyboard.scrollType,o.scrollAmount=r.snapAmount||r.keyboard.scrollAmount,"stepped"===o.type&&n.tweenRunning||$(i,e,t)}switch(t.type){case"blur":n.tweenRunning&&o.dir&&a("off",null);break;case"keydown":case"keyup":var s=t.keyCode?t.keyCode:t.which,l="on";if("x"!==r.axis&&(38===s||40===s)||"y"!==r.axis&&(37===s||39===s)){if((38===s||40===s)&&!n.overflowed[0]||(37===s||39===s)&&!n.overflowed[1])return;"keyup"===t.type&&(l="off"),e(document.activeElement).is(d)||(t.preventDefault(),t.stopImmediatePropagation(),a(l,s))}else if(33===s||34===s){if((n.overflowed[0]||n.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),"keyup"===t.type){Y(i);var h=34===s?-1:1;if("x"===r.axis||"yx"===r.axis&&n.overflowed[1]&&!n.overflowed[0])var p="x",f=Math.abs(c[0].offsetLeft)-.9*h*u.width();else var p="y",f=Math.abs(c[0].offsetTop)-.9*h*u.height();X(i,f.toString(),{dir:p,scrollEasing:"mcsEaseInOut"})}}else if((35===s||36===s)&&!e(document.activeElement).is(d)&&((n.overflowed[0]||n.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),"keyup"===t.type)){if("x"===r.axis||"yx"===r.axis&&n.overflowed[1]&&!n.overflowed[0])var p="x",f=35===s?Math.abs(u.width()-c.outerWidth(!1)):0;else var p="y",f=35===s?Math.abs(u.height()-c.outerHeight(!1)):0;X(i,f.toString(),{dir:p,scrollEasing:"mcsEaseInOut"})}}}var i=e(this),n=i.data(a),r=n.opt,o=n.sequential,s=a+"_"+n.idx,l=e("#mCSB_"+n.idx),c=e("#mCSB_"+n.idx+"_container"),u=c.parent(),d="input,textarea,select,datalist,keygen,[contenteditable='true']",h=c.find("iframe"),p=["blur."+s+" keydown."+s+" keyup."+s];h.length&&h.each(function(){e(this).load(function(){P(this)&&e(this.contentDocument||this.contentWindow.document).bind(p[0],function(e){t(e)})})}),l.attr("tabindex","0").bind(p[0],function(e){t(e)})},$=function(t,i,n,r,o){function s(e){var i="stepped"!==h.type,a=o?o:e?i?m/1.5:g:1e3/60,n=e?i?7.5:40:2.5,l=[Math.abs(p[0].offsetTop),Math.abs(p[0].offsetLeft)],u=[c.scrollRatio.y>10?10:c.scrollRatio.y,c.scrollRatio.x>10?10:c.scrollRatio.x],d="x"===h.dir[0]?l[1]+h.dir[1]*u[1]*n:l[0]+h.dir[1]*u[0]*n,f="x"===h.dir[0]?l[1]+h.dir[1]*parseInt(h.scrollAmount):l[0]+h.dir[1]*parseInt(h.scrollAmount),v="auto"!==h.scrollAmount?f:d,y=r?r:e?i?"mcsLinearOut":"mcsEaseInOut":"mcsLinear",b=e?!0:!1;return e&&17>a&&(v="x"===h.dir[0]?l[1]:l[0]),X(t,v.toString(),{dir:h.dir[0],scrollEasing:y,dur:a,onComplete:b}),e?void(h.dir=!1):(clearTimeout(h.step),void(h.step=setTimeout(function(){s()},a)))}function l(){clearTimeout(h.step),Z(h,"step"),Y(t)}var c=t.data(a),d=c.opt,h=c.sequential,p=e("#mCSB_"+c.idx+"_container"),f="stepped"===h.type?!0:!1,m=d.scrollInertia<26?26:d.scrollInertia,g=d.scrollInertia<1?17:d.scrollInertia;switch(i){case"on":if(h.dir=[n===u[16]||n===u[15]||39===n||37===n?"x":"y",n===u[13]||n===u[15]||38===n||37===n?-1:1],Y(t),te(n)&&"stepped"===h.type)return;s(f);break;case"off":l(),(f||c.tweenRunning&&h.dir)&&s(!0)}},z=function(t){var i=e(this).data(a).opt,n=[];return"function"==typeof t&&(t=t()),t instanceof Array?n=t.length>1?[t[0],t[1]]:"x"===i.axis?[null,t[0]]:[t[0],null]:(n[0]=t.y?t.y:t.x||"x"===i.axis?null:t,n[1]=t.x?t.x:t.y||"y"===i.axis?null:t),"function"==typeof n[0]&&(n[0]=n[0]()),"function"==typeof n[1]&&(n[1]=n[1]()),n},N=function(t,i){if(null!=t&&"undefined"!=typeof t){var n=e(this),r=n.data(a),o=r.opt,s=e("#mCSB_"+r.idx+"_container"),l=s.parent(),c=typeof t;i||(i="x"===o.axis?"x":"y");var u="x"===i?s.outerWidth(!1):s.outerHeight(!1),h="x"===i?s[0].offsetLeft:s[0].offsetTop,p="x"===i?"left":"top";switch(c){case"function":return t();case"object":var f=t.jquery?t:e(t);if(!f.length)return;return"x"===i?ie(f)[1]:ie(f)[0];case"string":case"number":if(te(t))return Math.abs(t);if(-1!==t.indexOf("%"))return Math.abs(u*parseInt(t)/100);if(-1!==t.indexOf("-="))return Math.abs(h-parseInt(t.split("-=")[1]));if(-1!==t.indexOf("+=")){var m=h+parseInt(t.split("+=")[1]);return m>=0?0:Math.abs(m)}if(-1!==t.indexOf("px")&&te(t.split("px")[0]))return Math.abs(t.split("px")[0]);if("top"===t||"left"===t)return 0;if("bottom"===t)return Math.abs(l.height()-s.outerHeight(!1));if("right"===t)return Math.abs(l.width()-s.outerWidth(!1));if("first"===t||"last"===t){var f=s.find(":"+t);return"x"===i?ie(f)[1]:ie(f)[0]}return e(t).length?"x"===i?ie(e(t))[1]:ie(e(t))[0]:(s.css(p,t),void d.update.call(null,n[0]))}}},U=function(t){function i(){clearTimeout(p[0].autoUpdate),p[0].autoUpdate=setTimeout(function(){return h.advanced.updateOnSelectorChange&&(f=o(),f!==w)?(s(3),void(w=f)):(h.advanced.updateOnContentResize&&(m=[p.outerHeight(!1),p.outerWidth(!1),v.height(),v.width(),b()[0],b()[1]],(m[0]!==x[0]||m[1]!==x[1]||m[2]!==x[2]||m[3]!==x[3]||m[4]!==x[4]||m[5]!==x[5])&&(s(m[0]!==x[0]||m[1]!==x[1]),x=m)),h.advanced.updateOnImageLoad&&(g=n(),g!==_&&(p.find("img").each(function(){r(this)}),_=g)),void((h.advanced.updateOnSelectorChange||h.advanced.updateOnContentResize||h.advanced.updateOnImageLoad)&&i()))},60)}function n(){var e=0;return h.advanced.updateOnImageLoad&&(e=p.find("img").length),e}function r(t){function i(e,t){return function(){return t.apply(e,arguments)}}function a(){this.onload=null,e(t).addClass(u[2]),s(2)}if(e(t).hasClass(u[2]))return void s();var n=new Image;n.onload=i(n,a),n.src=t.src}function o(){h.advanced.updateOnSelectorChange===!0&&(h.advanced.updateOnSelectorChange="*");var t=0,i=p.find(h.advanced.updateOnSelectorChange);return h.advanced.updateOnSelectorChange&&i.length>0&&i.each(function(){t+=e(this).height()+e(this).width()}),t}function s(e){clearTimeout(p[0].autoUpdate),d.update.call(null,l[0],e)}var l=e(this),c=l.data(a),h=c.opt,p=e("#mCSB_"+c.idx+"_container");if(t)return clearTimeout(p[0].autoUpdate),void Z(p[0],"autoUpdate");var f,m,g,v=p.parent(),y=[e("#mCSB_"+c.idx+"_scrollbar_vertical"),e("#mCSB_"+c.idx+"_scrollbar_horizontal")],b=function(){return[y[0].is(":visible")?y[0].outerHeight(!0):0,y[1].is(":visible")?y[1].outerWidth(!0):0]},w=o(),x=[p.outerHeight(!1),p.outerWidth(!1),v.height(),v.width(),b()[0],b()[1]],_=n();i()},q=function(e,t,i){return Math.round(e/t)*t-i},Y=function(t){var i=t.data(a),n=e("#mCSB_"+i.idx+"_container,#mCSB_"+i.idx+"_container_wrapper,#mCSB_"+i.idx+"_dragger_vertical,#mCSB_"+i.idx+"_dragger_horizontal");n.each(function(){K.call(this)})},X=function(t,i,n){function r(e){return l&&c.callbacks[e]&&"function"==typeof c.callbacks[e]}function o(){return[c.callbacks.alwaysTriggerOffsets||b>=w[0]+_,c.callbacks.alwaysTriggerOffsets||-C>=b]}function s(){var e=[p[0].offsetTop,p[0].offsetLeft],i=[v[0].offsetTop,v[0].offsetLeft],a=[p.outerHeight(!1),p.outerWidth(!1)],r=[h.height(),h.width()];t[0].mcs={content:p,top:e[0],left:e[1],draggerTop:i[0],draggerLeft:i[1],topPct:Math.round(100*Math.abs(e[0])/(Math.abs(a[0])-r[0])),leftPct:Math.round(100*Math.abs(e[1])/(Math.abs(a[1])-r[1])),direction:n.dir}}var l=t.data(a),c=l.opt,u={trigger:"internal",dir:"y",scrollEasing:"mcsEaseOut",drag:!1,dur:c.scrollInertia,overwrite:"all",callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},n=e.extend(u,n),d=[n.dur,n.drag?0:n.dur],h=e("#mCSB_"+l.idx),p=e("#mCSB_"+l.idx+"_container"),f=p.parent(),m=c.callbacks.onTotalScrollOffset?z.call(t,c.callbacks.onTotalScrollOffset):[0,0],g=c.callbacks.onTotalScrollBackOffset?z.call(t,c.callbacks.onTotalScrollBackOffset):[0,0];if(l.trigger=n.trigger,(0!==f.scrollTop()||0!==f.scrollLeft())&&(e(".mCSB_"+l.idx+"_scrollbar").css("visibility","visible"),f.scrollTop(0).scrollLeft(0)),"_resetY"!==i||l.contentReset.y||(r("onOverflowYNone")&&c.callbacks.onOverflowYNone.call(t[0]),l.contentReset.y=1),"_resetX"!==i||l.contentReset.x||(r("onOverflowXNone")&&c.callbacks.onOverflowXNone.call(t[0]),l.contentReset.x=1),"_resetY"!==i&&"_resetX"!==i){switch(!l.contentReset.y&&t[0].mcs||!l.overflowed[0]||(r("onOverflowY")&&c.callbacks.onOverflowY.call(t[0]),l.contentReset.x=null),!l.contentReset.x&&t[0].mcs||!l.overflowed[1]||(r("onOverflowX")&&c.callbacks.onOverflowX.call(t[0]),l.contentReset.x=null),c.snapAmount&&(i=q(i,c.snapAmount,c.snapOffset)),n.dir){case"x":var v=e("#mCSB_"+l.idx+"_dragger_horizontal"),y="left",b=p[0].offsetLeft,w=[h.width()-p.outerWidth(!1),v.parent().width()-v.width()],x=[i,0===i?0:i/l.scrollRatio.x],_=m[1],C=g[1],j=_>0?_/l.scrollRatio.x:0,k=C>0?C/l.scrollRatio.x:0;break;case"y":var v=e("#mCSB_"+l.idx+"_dragger_vertical"),y="top",b=p[0].offsetTop,w=[h.height()-p.outerHeight(!1),v.parent().height()-v.height()],x=[i,0===i?0:i/l.scrollRatio.y],_=m[0],C=g[0],j=_>0?_/l.scrollRatio.y:0,k=C>0?C/l.scrollRatio.y:0}x[1]<0||0===x[0]&&0===x[1]?x=[0,0]:x[1]>=w[1]?x=[w[0],w[1]]:x[0]=-x[0],t[0].mcs||(s(),r("onInit")&&c.callbacks.onInit.call(t[0])),clearTimeout(p[0].onCompleteTimeout),(l.tweenRunning||!(0===b&&x[0]>=0||b===w[0]&&x[0]<=w[0]))&&(V(v[0],y,Math.round(x[1]),d[1],n.scrollEasing),V(p[0],y,Math.round(x[0]),d[0],n.scrollEasing,n.overwrite,{onStart:function(){n.callbacks&&n.onStart&&!l.tweenRunning&&(r("onScrollStart")&&(s(),c.callbacks.onScrollStart.call(t[0])),l.tweenRunning=!0,S(v),l.cbOffsets=o())},onUpdate:function(){n.callbacks&&n.onUpdate&&r("whileScrolling")&&(s(),c.callbacks.whileScrolling.call(t[0]))},onComplete:function(){if(n.callbacks&&n.onComplete){"yx"===c.axis&&clearTimeout(p[0].onCompleteTimeout);var e=p[0].idleTimer||0;p[0].onCompleteTimeout=setTimeout(function(){r("onScroll")&&(s(),c.callbacks.onScroll.call(t[0])),r("onTotalScroll")&&x[1]>=w[1]-j&&l.cbOffsets[0]&&(s(),c.callbacks.onTotalScroll.call(t[0])),r("onTotalScrollBack")&&x[1]<=k&&l.cbOffsets[1]&&(s(),c.callbacks.onTotalScrollBack.call(t[0])),l.tweenRunning=!1,p[0].idleTimer=0,S(v,"hide")},e)}}}))}},V=function(e,t,i,a,n,r,o){function s(){x.stop||(y||f.call(),y=G()-v,l(),y>=x.time&&(x.time=y>x.time?y+h-(y-x.time):y+h-1,x.time<y+1&&(x.time=y+1)),x.time<a?x.id=p(s):g.call())}function l(){a>0?(x.currVal=d(x.time,b,_,a,n),w[t]=Math.round(x.currVal)+"px"):w[t]=i+"px",m.call()}function c(){h=1e3/60,x.time=y+h,p=window.requestAnimationFrame?window.requestAnimationFrame:function(e){return l(),setTimeout(e,.01)},x.id=p(s)}function u(){null!=x.id&&(window.requestAnimationFrame?window.cancelAnimationFrame(x.id):clearTimeout(x.id),x.id=null)}function d(e,t,i,a,n){switch(n){case"linear":case"mcsLinear":return i*e/a+t;case"mcsLinearOut":return e/=a,e--,i*Math.sqrt(1-e*e)+t;case"easeInOutSmooth":return e/=a/2,1>e?i/2*e*e+t:(e--,-i/2*(e*(e-2)-1)+t);case"easeInOutStrong":return e/=a/2,1>e?i/2*Math.pow(2,10*(e-1))+t:(e--,i/2*(-Math.pow(2,-10*e)+2)+t);case"easeInOut":case"mcsEaseInOut":return e/=a/2,1>e?i/2*e*e*e+t:(e-=2,i/2*(e*e*e+2)+t);case"easeOutSmooth":return e/=a,e--,-i*(e*e*e*e-1)+t;case"easeOutStrong":return i*(-Math.pow(2,-10*e/a)+1)+t;case"easeOut":case"mcsEaseOut":default:var r=(e/=a)*e,o=r*e;return t+i*(.499999999999997*o*r+-2.5*r*r+5.5*o+-6.5*r+4*e)}}e._mTween||(e._mTween={top:{},left:{}});var h,p,o=o||{},f=o.onStart||function(){},m=o.onUpdate||function(){},g=o.onComplete||function(){},v=G(),y=0,b=e.offsetTop,w=e.style,x=e._mTween[t];"left"===t&&(b=e.offsetLeft);var _=i-b;x.stop=0,"none"!==r&&u(),c()},G=function(){return window.performance&&window.performance.now?window.performance.now():window.performance&&window.performance.webkitNow?window.performance.webkitNow():Date.now?Date.now():(new Date).getTime()},K=function(){var e=this;e._mTween||(e._mTween={top:{},left:{}});for(var t=["top","left"],i=0;i<t.length;i++){var a=t[i];e._mTween[a].id&&(window.requestAnimationFrame?window.cancelAnimationFrame(e._mTween[a].id):clearTimeout(e._mTween[a].id),e._mTween[a].id=null,e._mTween[a].stop=1)}},Z=function(e,t){try{delete e[t]}catch(i){e[t]=null}},J=function(e){return!(e.which&&1!==e.which)},ee=function(e){var t=e.originalEvent.pointerType;return!(t&&"touch"!==t&&2!==t)},te=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},ie=function(e){var t=e.parents(".mCSB_container");return[e.offset().top-t.offset().top,e.offset().left-t.offset().left]};e.fn[i]=function(t){return d[t]?d[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):d.init.apply(this,arguments)},e[i]=function(t){return d[t]?d[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):d.init.apply(this,arguments)},e[i].defaults=r,window[i]=!0,e(window).load(function(){e(n)[i](),e.extend(e.expr[":"],{mcsInView:e.expr[":"].mcsInView||function(t){var i,a,n=e(t),r=n.parents(".mCSB_container");return r.length?(i=r.parent(),a=[r[0].offsetTop,r[0].offsetLeft],a[0]+ie(n)[0]>=0&&a[0]+ie(n)[0]<i.height()-n.outerHeight(!1)&&a[1]+ie(n)[1]>=0&&a[1]+ie(n)[1]<i.width()-n.outerWidth(!1)):void 0},mcsOverflow:e.expr[":"].mcsOverflow||function(t){var i=e(t).data(a);return i?i.overflowed[0]||i.overflowed[1]:void 0}})})})}),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){"use strict";var t=e(window),i=e(document),a=window.location,n=!0,r=!1,o=null,s=NaN,l=1/0,c="undefined",u="directive",d=".cropper",h=/^(e|n|w|s|ne|nw|sw|se|all|crop|move|zoom)#x2F;,p=/^(x|y|width|height)#x2F;,f=/^(naturalWidth|naturalHeight|width|height|aspectRatio|ratio|rotate)#x2F;,m="cropper-modal",g="cropper-hidden",v="cropper-invisible",y="cropper-move",b="cropper-crop",w="cropper-disabled",x="mousedown touchstart",_="mousemove touchmove",C="mouseup mouseleave touchend touchleave touchcancel",S="wheel mousewheel DOMMouseScroll",j="resize"+d,k="dblclick",Q="build"+d,T="built"+d,D="dragstart"+d,O="dragmove"+d,E="dragend"+d,M=function(e){return"number"==typeof e},I=function(e,t){var i=[];return"number"==typeof t&&i.push(t),i.slice.apply(e,i)},A=function(e,t){var i=I(arguments,2);return function(){return e.apply(t,i.concat(I(arguments)))}},P=function(t,i){this.element=t,this.$element=e(t),this.defaults=e.extend({},P.DEFAULTS,e.isPlainObject(i)?i:{}),this.$original=o,this.ready=r,this.built=r,this.cropped=r,this.rotated=r,this.disabled=r,this.replaced=r,this.init()},R=Math.sqrt,H=Math.min,F=Math.max,L=Math.abs,B=Math.sin,W=Math.cos,$=parseFloat;P.prototype={constructor:P,support:{canvas:e.isFunction(e("<canvas>")[0].getContext)},init:function(){var t=this.defaults;e.each(t,function(e,i){switch(e){case"aspectRatio":t[e]=L($(i))||s;break;case"autoCropArea":t[e]=L($(i))||.8;break;case"minWidth":case"minHeight":t[e]=L($(i))||0;break;case"maxWidth":case"maxHeight":t[e]=L($(i))||l}}),this.image={rotate:0},this.load()},load:function(){var t,i,a=this,r=this.$element,o=this.element,s=this.image,l="";r.is("img")?i=r.prop("src"):r.is("canvas")&&this.support.canvas&&(i=o.toDataURL()),i&&(this.replaced&&(s.rotate=0),this.defaults.checkImageOrigin&&(r.prop("crossOrigin")||this.isCrossOriginURL(i))&&(l=" crossOrigin"),this.$clone=t=e("<img"+l+' src="'+i+'">'),t.one("load",function(){s.naturalWidth=this.naturalWidth||t.width(),s.naturalHeight=this.naturalHeight||t.height(),s.aspectRatio=s.naturalWidth/s.naturalHeight,a.url=i,a.ready=n,a.build()}),t.addClass(v).prependTo("body"))},isCrossOriginURL:function(e){var t=e.match(/^(https?:)\/\/([^\:\/\?#]+):?(\d*)/i);return!t||t[1]===a.protocol&&t[2]===a.hostname&&t[3]===a.port?r:n},build:function(){var t,i,a=this.$element,o=this.defaults;this.ready&&(this.built&&this.unbuild(),a.one(Q,o.build),t=e.Event(Q),a.trigger(t),t.isDefaultPrevented()||(this.$cropper=i=e(P.TEMPLATE),a.addClass(g),this.$clone.removeClass(v).prependTo(i),this.rotated||(this.$original=this.$clone.clone(),this.$original.addClass(g).prependTo(this.$cropper),this.originalImage=e.extend({},this.image)),this.$container=a.parent(),this.$container.append(i),this.$canvas=i.find(".cropper-canvas"),this.$dragger=i.find(".cropper-dragger"),this.$viewer=i.find(".cropper-viewer"),o.autoCrop?this.cropped=n:this.$dragger.addClass(g),o.dragCrop&&this.setDragMode("crop"),o.modal&&this.$canvas.addClass(m),!o.dashed&&this.$dragger.find(".cropper-dashed").addClass(g),!o.movable&&this.$dragger.find(".cropper-face").data(u,"move"),!o.resizable&&this.$dragger.find(".cropper-line, .cropper-point").addClass(g),
7
- this.addListeners(),this.initPreview(),this.built=n,this.update(),this.replaced=r,a.one(T,o.built),a.trigger(T)))},unbuild:function(){this.built&&(this.built=r,this.removeListeners(),this.$preview.empty(),this.$preview=o,this.$dragger=o,this.$canvas=o,this.$container=o,this.$cropper.remove(),this.$cropper=o)},update:function(e){this.initContainer(),this.initCropper(),this.initImage(),this.initDragger(),e?(this.setData(e,n),this.setDragMode("crop")):this.setData(this.defaults.data)},resize:function(){clearTimeout(this.resizing),this.resizing=setTimeout(e.proxy(this.update,this,this.getData()),200)},preview:function(){var t=this.image,i=this.dragger,a=t.width,n=t.height,r=i.left-t.left,o=i.top-t.top;this.$viewer.find("img").css({width:a,height:n,marginLeft:-r,marginTop:-o}),this.$preview.each(function(){var t=e(this),s=t.width()/i.width;t.find("img").css({width:a*s,height:n*s,marginLeft:-r*s,marginTop:-o*s})})},addListeners:function(){var a=this.defaults;this.$element.on(D,a.dragstart).on(O,a.dragmove).on(E,a.dragend),this.$cropper.on(x,e.proxy(this.dragstart,this)).on(k,e.proxy(this.dblclick,this)),a.zoomable&&this.$cropper.on(S,e.proxy(this.wheel,this)),a.multiple?this.$cropper.on(_,e.proxy(this.dragmove,this)).on(C,e.proxy(this.dragend,this)):i.on(_,this._dragmove=A(this.dragmove,this)).on(C,this._dragend=A(this.dragend,this)),t.on(j,this._resize=A(this.resize,this))},removeListeners:function(){var e=this.defaults;this.$element.off(D,e.dragstart).off(O,e.dragmove).off(E,e.dragend),this.$cropper.off(x,this.dragstart).off(k,this.dblclick),e.zoomable&&this.$cropper.off(S,this.wheel),e.multiple?this.$cropper.off(_,this.dragmove).off(C,this.dragend):i.off(_,this._dragmove).off(C,this._dragend),t.off(j,this._resize)},initPreview:function(){var t='<img src="'+this.url+'">';this.$preview=e(this.defaults.preview),this.$viewer.html(t),this.$preview.html(t).find("img").css("cssText","min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;")},initContainer:function(){var e=this.$container;this.container={width:F(e.width(),300),height:F(e.height(),150)}},initCropper:function(){var e,t=this.container,i=this.image;i.naturalWidth*t.height/i.naturalHeight-t.width>=0?(e={width:t.width,height:t.width/i.aspectRatio,left:0},e.top=(t.height-e.height)/2):(e={width:t.height*i.aspectRatio,height:t.height,top:0},e.left=(t.width-e.width)/2),this.$cropper.css({width:e.width,height:e.height,left:e.left,top:e.top}),this.cropper=e},initImage:function(){var t=this.image,i=this.cropper,a={_width:i.width,_height:i.height,width:i.width,height:i.height,left:0,top:0,ratio:i.width/t.naturalWidth};this.defaultImage=e.extend({},t,a),t._width!==i.width||t._height!==i.height?e.extend(t,a):(t=e.extend({},a,t),this.replaced&&(t.ratio=a.ratio)),this.image=t,this.renderImage()},renderImage:function(e){var t=this.image;"zoom"===e&&(t.left-=(t.width-t.oldWidth)/2,t.top-=(t.height-t.oldHeight)/2),t.left=H(F(t.left,t._width-t.width),0),t.top=H(F(t.top,t._height-t.height),0),this.$clone.css({width:t.width,height:t.height,marginLeft:t.left,marginTop:t.top}),e&&(this.defaults.done(this.getData()),this.preview())},initDragger:function(){var t,i=this.defaults,a=this.cropper,n=i.aspectRatio||this.image.aspectRatio,r=this.image.ratio;t=a.height*n-a.width>=0?{height:a.width/n,width:a.width,left:0,top:(a.height-a.width/n)/2,maxWidth:a.width,maxHeight:a.width/n}:{height:a.height,width:a.height*n,left:(a.width-a.height*n)/2,top:0,maxWidth:a.height*n,maxHeight:a.height},t.minWidth=0,t.minHeight=0,i.aspectRatio?(isFinite(i.maxWidth)?(t.maxWidth=H(t.maxWidth,i.maxWidth*r),t.maxHeight=t.maxWidth/n):isFinite(i.maxHeight)&&(t.maxHeight=H(t.maxHeight,i.maxHeight*r),t.maxWidth=t.maxHeight*n),i.minWidth>0?(t.minWidth=F(0,i.minWidth*r),t.minHeight=t.minWidth/n):i.minHeight>0&&(t.minHeight=F(0,i.minHeight*r),t.minWidth=t.minHeight*n)):(t.maxWidth=H(t.maxWidth,i.maxWidth*r),t.maxHeight=H(t.maxHeight,i.maxHeight*r),t.minWidth=F(0,i.minWidth*r),t.minHeight=F(0,i.minHeight*r)),t.minWidth=H(t.maxWidth,t.minWidth),t.minHeight=H(t.maxHeight,t.minHeight),t.height*=i.autoCropArea,t.width*=i.autoCropArea,t.left=(a.width-t.width)/2,t.top=(a.height-t.height)/2,t.oldLeft=t.left,t.oldTop=t.top,this.defaultDragger=t,this.dragger=e.extend({},t)},renderDragger:function(){var e=this.dragger,t=this.cropper;e.width>e.maxWidth?(e.width=e.maxWidth,e.left=e.oldLeft):e.width<e.minWidth&&(e.width=e.minWidth,e.left=e.oldLeft),e.height>e.maxHeight?(e.height=e.maxHeight,e.top=e.oldTop):e.height<e.minHeight&&(e.height=e.minHeight,e.top=e.oldTop),e.left=H(F(e.left,0),t.width-e.width),e.top=H(F(e.top,0),t.height-e.height),e.oldLeft=e.left,e.oldTop=e.top,this.dragger=e,this.disabled||this.defaults.done(this.getData()),this.$dragger.css({width:e.width,height:e.height,left:e.left,top:e.top}),this.preview()},reset:function(t){this.cropped&&(t&&(this.defaults.data={}),this.image=e.extend({},this.defaultImage),this.renderImage(),this.dragger=e.extend({},this.defaultDragger),this.setData(this.defaults.data))},clear:function(){this.cropped&&(this.cropped=r,this.setData({x:0,y:0,width:0,height:0}),this.$canvas.removeClass(m),this.$dragger.addClass(g))},destroy:function(){var e=this.$element;this.ready&&(this.unbuild(),e.removeClass(g).removeData("cropper"),this.rotated&&e.attr("src",this.$original.attr("src")))},replace:function(t,i){var a,o=this,s=this.$element,l=this.element;t&&t!==this.url&&t!==s.attr("src")&&(i||(this.rotated=r,this.replaced=n),s.is("img")?(s.attr("src",t),this.load()):s.is("canvas")&&this.support.canvas&&(a=l.getContext("2d"),e('<img src="'+t+'">').one("load",function(){l.width=this.width,l.height=this.height,a.clearRect(0,0,l.width,l.height),a.drawImage(this,0,0),o.load()})))},setData:function(t,i){var a=this.cropper,n=this.dragger,r=this.image,s=this.defaults.aspectRatio;this.built&&typeof t!==c&&((t===o||e.isEmptyObject(t))&&(n=e.extend({},this.defaultDragger)),e.isPlainObject(t)&&!e.isEmptyObject(t)&&(i||(this.defaults.data=t),t=this.transformData(t),M(t.x)&&t.x<=a.width-r.left&&(n.left=t.x+r.left),M(t.y)&&t.y<=a.height-r.top&&(n.top=t.y+r.top),s?M(t.width)&&t.width<=n.maxWidth&&t.width>=n.minWidth?(n.width=t.width,n.height=n.width/s):M(t.height)&&t.height<=n.maxHeight&&t.height>=n.minHeight&&(n.height=t.height,n.width=n.height*s):(M(t.width)&&t.width<=n.maxWidth&&t.width>=n.minWidth&&(n.width=t.width),M(t.height)&&t.height<=n.maxHeight&&t.height>=n.minHeight&&(n.height=t.height))),this.dragger=n,this.renderDragger())},getData:function(e){var t=this.dragger,i=this.image,a={};return this.built&&(a={x:t.left-i.left,y:t.top-i.top,width:t.width,height:t.height},a=this.transformData(a,n,e)),a},transformData:function(t,i,a){var n=this.image.ratio,r={};return e.each(t,function(e,t){t=$(t),p.test(e)&&!isNaN(t)&&(r[e]=i?a?Math.round(t/n):t/n:t*n)}),r},setAspectRatio:function(e){var t="auto"===e;e=$(e),(t||!isNaN(e)&&e>0)&&(this.defaults.aspectRatio=t?s:e,this.built&&(this.initDragger(),this.renderDragger()))},getImageData:function(){var t={};return this.ready&&e.each(this.image,function(e,i){f.test(e)&&(t[e]=i)}),t},getDataURL:function(t,i,a){var n,r=e("<canvas>")[0],o=this.getData(),s="";return e.isPlainObject(t)||(a=i,i=t,t={}),t=e.extend({width:o.width,height:o.height},t),this.cropped&&this.support.canvas&&(r.width=t.width,r.height=t.height,n=r.getContext("2d"),"image/jpeg"===i&&(n.fillStyle="#fff",n.fillRect(0,0,t.width,t.height)),n.drawImage(this.$clone[0],o.x,o.y,o.width,o.height,0,0,t.width,t.height),s=r.toDataURL(i,a)),s},setDragMode:function(e){var t=this.$canvas,i=this.defaults,a=r,o=r;if(this.built&&!this.disabled){switch(e){case"crop":i.dragCrop&&(a=n,t.data(u,e));break;case"move":o=n,t.data(u,e);break;default:t.removeData(u)}t.toggleClass(b,a).toggleClass(y,o)}},enable:function(){this.built&&(this.disabled=r,this.$cropper.removeClass(w))},disable:function(){this.built&&(this.disabled=n,this.$cropper.addClass(w))},rotate:function(e){var t=this.image;e=$(e)||0,this.built&&0!==e&&!this.disabled&&this.defaults.rotatable&&this.support.canvas&&(this.rotated=n,e=t.rotate=(t.rotate+e)%360,this.replace(this.getRotatedDataURL(e),!0))},getRotatedDataURL:function(t){var i=e("<canvas>")[0],a=i.getContext("2d"),n=t*Math.PI/180,r=L(t)%180,o=r>90?180-r:r,s=o*Math.PI/180,l=this.originalImage,c=l.naturalWidth,u=l.naturalHeight,d=L(c*W(s)+u*B(s)),h=L(c*B(s)+u*W(s));return i.width=d,i.height=h,a.save(),a.translate(d/2,h/2),a.rotate(n),a.drawImage(this.$original[0],-c/2,-u/2,c,u),a.restore(),i.toDataURL()},zoom:function(e){var t,i,a,n=this.image;e=$(e),this.built&&e&&!this.disabled&&this.defaults.zoomable&&(t=n.width*(1+e),i=n.height*(1+e),a=t/n._width,a>10||(1>a&&(t=n._width,i=n._height),1>=a?this.setDragMode("crop"):this.setDragMode("move"),n.oldWidth=n.width,n.oldHeight=n.height,n.width=t,n.height=i,n.ratio=n.width/n.naturalWidth,this.renderImage("zoom")))},dblclick:function(){this.disabled||(this.$canvas.hasClass(b)?this.setDragMode("move"):this.setDragMode("crop"))},wheel:function(e){var t,i=e.originalEvent,a=117.25,n=5,r=166.66665649414062,o=.1;this.disabled||(e.preventDefault(),i.deltaY?(t=i.deltaY,t=t%n===0?t/n:t%a===0?t/a:t/r):t=i.wheelDelta?-i.wheelDelta/120:i.detail?i.detail/3:0,this.zoom(t*o))},dragstart:function(t){var i,a,o,s=t.originalEvent.touches,l=t;if(!this.disabled){if(s){if(o=s.length,o>1){if(!this.defaults.zoomable||2!==o)return;l=s[1],this.startX2=l.pageX,this.startY2=l.pageY,i="zoom"}l=s[0]}if(i=i||e(l.target).data(u),h.test(i)){if(t.preventDefault(),a=e.Event(D),this.$element.trigger(a),a.isDefaultPrevented())return;this.directive=i,this.cropping=r,this.startX=l.pageX,this.startY=l.pageY,"crop"===i&&(this.cropping=n,this.$canvas.addClass(m))}}},dragmove:function(t){var i,a,n=t.originalEvent.touches,r=t;if(!this.disabled){if(n){if(a=n.length,a>1){if(!this.defaults.zoomable||2!==a)return;r=n[1],this.endX2=r.pageX,this.endY2=r.pageY}r=n[0]}if(this.directive){if(t.preventDefault(),i=e.Event(O),this.$element.trigger(i),i.isDefaultPrevented())return;this.endX=r.pageX,this.endY=r.pageY,this.dragging()}}},dragend:function(t){var i;if(!this.disabled&&this.directive){if(t.preventDefault(),i=e.Event(E),this.$element.trigger(i),i.isDefaultPrevented())return;this.cropping&&(this.cropping=r,this.$canvas.toggleClass(m,this.cropped&&this.defaults.modal)),this.directive=""}},dragging:function(){var e,t=this.directive,i=this.image,a=this.cropper,o=a.width,s=a.height,l=this.dragger,c=l.width,u=l.height,d=l.left,h=l.top,p=d+c,f=h+u,m=n,v=this.defaults,y=v.aspectRatio,b={x:this.endX-this.startX,y:this.endY-this.startY};switch(y&&(b.X=b.y*y,b.Y=b.x/y),t){case"all":d+=b.x,h+=b.y;break;case"e":if(b.x>=0&&(p>=o||y&&(0>=h||f>=s))){m=r;break}c+=b.x,y&&(u=c/y,h-=b.Y/2),0>c&&(t="w",c=0);break;case"n":if(b.y<=0&&(0>=h||y&&(0>=d||p>=o))){m=r;break}u-=b.y,h+=b.y,y&&(c=u*y,d+=b.X/2),0>u&&(t="s",u=0);break;case"w":if(b.x<=0&&(0>=d||y&&(0>=h||f>=s))){m=r;break}c-=b.x,d+=b.x,y&&(u=c/y,h+=b.Y/2),0>c&&(t="e",c=0);break;case"s":if(b.y>=0&&(f>=s||y&&(0>=d||p>=o))){m=r;break}u+=b.y,y&&(c=u*y,d-=b.X/2),0>u&&(t="n",u=0);break;case"ne":if(y){if(b.y<=0&&(0>=h||p>=o)){m=r;break}u-=b.y,h+=b.y,c=u*y}else b.x>=0?o>p?c+=b.x:b.y<=0&&0>=h&&(m=r):c+=b.x,b.y<=0?h>0&&(u-=b.y,h+=b.y):(u-=b.y,h+=b.y);0>u&&(t="sw",u=0,c=0);break;case"nw":if(y){if(b.y<=0&&(0>=h||0>=d)){m=r;break}u-=b.y,h+=b.y,c=u*y,d+=b.X}else b.x<=0?d>0?(c-=b.x,d+=b.x):b.y<=0&&0>=h&&(m=r):(c-=b.x,d+=b.x),b.y<=0?h>0&&(u-=b.y,h+=b.y):(u-=b.y,h+=b.y);0>u&&(t="se",u=0,c=0);break;case"sw":if(y){if(b.x<=0&&(0>=d||f>=s)){m=r;break}c-=b.x,d+=b.x,u=c/y}else b.x<=0?d>0?(c-=b.x,d+=b.x):b.y>=0&&f>=s&&(m=r):(c-=b.x,d+=b.x),b.y>=0?s>f&&(u+=b.y):u+=b.y;0>c&&(t="ne",u=0,c=0);break;case"se":if(y){if(b.x>=0&&(p>=o||f>=s)){m=r;break}c+=b.x,u=c/y}else b.x>=0?o>p?c+=b.x:b.y>=0&&f>=s&&(m=r):c+=b.x,b.y>=0?s>f&&(u+=b.y):u+=b.y;0>c&&(t="nw",u=0,c=0);break;case"move":i.left+=b.x,i.top+=b.y,this.renderImage("move"),m=r;break;case"zoom":v.zoomable&&(this.zoom(function(e,t,i,a,n,r){return(R(n*n+r*r)-R(i*i+a*a))/R(e*e+t*t)}(i.width,i.height,L(this.startX-this.startX2),L(this.startY-this.startY2),L(this.endX-this.endX2),L(this.endY-this.endY2))),this.endX2=this.startX2,this.endY2=this.startY2);break;case"crop":b.x&&b.y&&(e=this.$cropper.offset(),d=this.startX-e.left,h=this.startY-e.top,c=l.minWidth,u=l.minHeight,b.x>0?b.y>0?t="se":(t="ne",h-=u):b.y>0?(t="sw",d-=c):(t="nw",d-=c,h-=u),this.cropped||(this.cropped=n,this.$dragger.removeClass(g)))}m&&(l.width=c,l.height=u,l.left=d,l.top=h,this.directive=t,this.renderDragger()),this.startX=this.endX,this.startY=this.endY}},P.TEMPLATE=function(e,t){return t=t.split(","),e.replace(/\d+/g,function(e){return t[e]})}('<0 6="5-container"><0 6="5-canvas"></0><0 6="5-dragger"><1 6="5-viewer"></1><1 6="5-8 8-h"></1><1 6="5-8 8-v"></1><1 6="5-face" 3-2="all"></1><1 6="5-7 7-e" 3-2="e"></1><1 6="5-7 7-n" 3-2="n"></1><1 6="5-7 7-w" 3-2="w"></1><1 6="5-7 7-s" 3-2="s"></1><1 6="5-4 4-e" 3-2="e"></1><1 6="5-4 4-n" 3-2="n"></1><1 6="5-4 4-w" 3-2="w"></1><1 6="5-4 4-s" 3-2="s"></1><1 6="5-4 4-ne" 3-2="ne"></1><1 6="5-4 4-nw" 3-2="nw"></1><1 6="5-4 4-sw" 3-2="sw"></1><1 6="5-4 4-se" 3-2="se"></1></0></0>',"div,span,directive,data,point,cropper,class,line,dashed"),P.DEFAULTS={aspectRatio:"auto",autoCropArea:.8,data:{},done:e.noop,preview:"",multiple:r,autoCrop:n,dragCrop:n,dashed:n,modal:n,movable:n,resizable:n,zoomable:n,rotatable:n,checkImageOrigin:n,minWidth:0,minHeight:0,maxWidth:l,maxHeight:l,build:o,built:o,dragstart:o,dragmove:o,dragend:o},P.setDefaults=function(t){e.extend(P.DEFAULTS,t)},P.other=e.fn.cropper,e.fn.cropper=function(t){var i,a=I(arguments,1);return this.each(function(){var n,r=e(this),o=r.data("cropper");o||r.data("cropper",o=new P(this,t)),"string"==typeof t&&e.isFunction(n=o[t])&&(i=n.apply(o,a))}),typeof i!==c?i:this},e.fn.cropper.Constructor=P,e.fn.cropper.setDefaults=P.setDefaults,e.fn.cropper.noConflict=function(){return e.fn.cropper=P.other,this}}),function(e){function t(e,t){return"function"==typeof e?e.call(t):e}function i(e){for(;e=e.parentNode;)if(e==document)return!0;return!1}function a(t,i){this.$element=e(t),this.options=i,this.enabled=!0,this.fixTitle()}a.prototype={show:function(){var i=this.getTitle();if(i&&this.enabled){var a=this.tip();a.find(".tipsy-inner")[this.options.html?"html":"text"](i),a[0].className="tipsy",a.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var n,r=e.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight}),o=a[0].offsetWidth,s=a[0].offsetHeight,l=t(this.options.gravity,this.$element[0]);switch(l.charAt(0)){case"n":n={top:r.top+r.height+this.options.offset,left:r.left+r.width/2-o/2};break;case"s":n={top:r.top-s-this.options.offset,left:r.left+r.width/2-o/2};break;case"e":n={top:r.top+r.height/2-s/2,left:r.left-o-this.options.offset};break;case"w":extra_gap=0,e("body").css("position").length>0&&"relative"==e("body").css("position")&&e("#wpadminbar").length&&(extra_gap=e("#wpadminbar").height()),n={top:r.top+r.height/2-s/2-extra_gap,left:r.left+r.width+this.options.offset}}2==l.length&&("w"==l.charAt(1)?n.left=r.left+r.width/2-15:n.left=r.left+r.width/2-o+15),a.css(n).addClass("tipsy-"+l),a.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+l.charAt(0),this.options.className&&a.addClass(t(this.options.className,this.$element[0])),this.options.fade?a.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):a.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){e(this).remove()}):this.tip().remove()},fixTitle:function(){var e=this.$element;(e.attr("title")||"string"!=typeof e.attr("original-title"))&&e.attr("original-title",e.attr("title")||"").removeAttr("title")},getTitle:function(){var e,t=this.$element,i=this.options;this.fixTitle();var e,i=this.options;return"string"==typeof i.title?e=t.attr("title"==i.title?"original-title":i.title):"function"==typeof i.title&&(e=i.title.call(t[0])),e=(""+e).replace(/(^\s*|\s*$)/,""),e||i.fallback},tip:function(){return this.$tip||(this.$tip=e('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>'),this.$tip.data("tipsy-pointee",this.$element[0])),this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}},e.fn.tipsy=function(t){function i(i){var n=e.data(i,"tipsy");return n||(n=new a(i,e.fn.tipsy.elementOptions(i,t)),e.data(i,"tipsy",n)),n}function n(){var e=i(this);e.hoverState="in",0==t.delayIn?e.show():(e.fixTitle(),setTimeout(function(){"in"==e.hoverState&&e.show()},t.delayIn))}function r(){var e=i(this);e.hoverState="out",0==t.delayOut?e.hide():setTimeout(function(){"out"==e.hoverState&&e.hide()},t.delayOut)}if(t===!0)return this.data("tipsy");if("string"==typeof t){var o=this.data("tipsy");return o&&o[t](),this}if(t=e.extend({},e.fn.tipsy.defaults,t),t.live||this.each(function(){i(this)}),"manual"!=t.trigger){var s="hover"==t.trigger?"mouseenter":"focus",l="hover"==t.trigger?"mouseleave":"blur";t.live?e(document).on(s,this.selector,n).on(l,this.selector,r):this.bind(s,n).bind(l,r)}return this},e.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:.8,title:"title",trigger:"hover"},e.fn.tipsy.revalidate=function(){e(".tipsy").each(function(){var t=e.data(this,"tipsy-pointee");t&&i(t)||e(this).remove()})},e.fn.tipsy.elementOptions=function(t,i){return e.metadata?e.extend({},i,e(t).metadata()):i},e.fn.tipsy.autoNS=function(){return e(this).offset().top>e(document).scrollTop()+e(window).height()/2?"s":"n"},e.fn.tipsy.autoWE=function(){return e(this).offset().left>e(document).scrollLeft()+e(window).width()/2?"e":"w"},e.fn.tipsy.autoBounds=function(t,i){return function(){var a={ns:i[0],ew:i.length>1?i[1]:!1},n=e(document).scrollTop()+t,r=e(document).scrollLeft()+t,o=e(this);return o.offset().top<n&&(a.ns="n"),o.offset().left<r&&(a.ew="w"),e(window).width()+e(document).scrollLeft()-o.offset().left<t&&(a.ew="e"),e(window).height()+e(document).scrollTop()-o.offset().top<t&&(a.ns="s"),a.ns+(a.ew?a.ew:"")}}}(jQuery);var live_field,live_value,xhrValidateUsername=!1;jQuery(document).ready(function(){2==jQuery("input[data-key=user_password],input[data-key=confirm_user_password]").length&&UM_check_password_matched()}),jQuery(function(){jQuery(".um-search form *").keypress(function(e){return 13==e.which?(jQuery(".um-search form").submit(),!1):void 0}),jQuery(document).on("touchend",function(){jQuery(".select2-search, .select2-focusser").remove()})}),jQuery(window).load(function(){um_responsive(),um_modal_responsive()}),jQuery(window).resize(function(){responsive_Modal(),jQuery("img.cropper-hidden").cropper("destroy"),um_responsive(),um_modal_responsive()}),jQuery(document).ready(function(){jQuery(document).on("input",".um-field input[type=text]",function(){live_field=jQuery(this).parents(".um-field").data("key"),live_value=jQuery(this).val(),um_conditional()}),jQuery(".um-field input[type=text]").trigger("input"),jQuery(document).on("change",".um-field select, .um-field input[type=radio], .um-field input[type=checkbox]",function(){live_field=jQuery(this).parents(".um-field").data("key"),live_value=jQuery(this).val(),jQuery(this).is(":checkbox")&&(jQuery(this).parents(".um-field").find("input:checked").length>1?(live_value="",jQuery(this).parents(".um-field").find("input:checked").each(function(){live_value=live_value+jQuery(this).val()+" "})):live_value=jQuery(this).parents(".um-field").find("input:checked").val()),jQuery(this).is(":radio")&&(live_value=jQuery(this).parents(".um-field").find("input[type=radio]:checked").val()),um_conditional()}),jQuery(".um-field select, .um-field input[type=radio], .um-field input[type=checkbox]").trigger("change")}),jQuery(document).ready(function(){jQuery(document).on("click",".um-dropdown a",function(e){return!1}),jQuery(document).on("click",".um-dropdown a.real_url",function(e){window.location=jQuery(this).attr("href")}),jQuery(document).on("click",".um-trigger-menu-on-click",function(e){return jQuery(".um-dropdown").hide(),menu=jQuery(this).find(".um-dropdown"),menu.show(),!1}),jQuery(document).on("click",".um-dropdown-hide",function(e){UM_hide_menus()}),jQuery(document).on("click","a.um-manual-trigger",function(){var e=jQuery(this).attr("data-child"),t=jQuery(this).attr("data-parent");jQuery(this).parents(t).find(e).trigger("click")}),jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,live:"a.live",offset:3}),jQuery(document).on("change",".um-field-area input[type=radio]",function(){var e=jQuery(this).parents(".um-field-area"),t=jQuery(this).parents("label");e.find(".um-field-radio").removeClass("active"),e.find(".um-field-radio").find("i").removeClass().addClass("um-icon-android-radio-button-off"),t.addClass("active"),t.find("i").removeClass().addClass("um-icon-android-radio-button-on")}),jQuery(document).on("change",".um-field-area input[type=checkbox]",function(){var e=(jQuery(this).parents(".um-field-area"),jQuery(this).parents("label"));e.hasClass("active")?(e.removeClass("active"),e.find("i").removeClass().addClass("um-icon-android-checkbox-outline-blank")):(e.addClass("active"),e.find("i").removeClass().addClass("um-icon-android-checkbox-outline"))}),jQuery(".um-datepicker").each(function(){if(elem=jQuery(this),""!=elem.attr("data-disabled_weekdays"))var e=JSON.parse(elem.attr("data-disabled_weekdays"));else var e=!1;var t=elem.attr("data-years"),i=elem.attr("data-date_min"),a=elem.attr("data-date_max"),i=i.length?new Date(i.split(",")):null,a=a.length?new Date(a.split(",")):null;elem.pickadate({selectYears:t,min:i,max:a,disable:e,format:elem.attr("data-format"),formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}})}),jQuery(".um-timepicker").each(function(){elem=jQuery(this),elem.pickatime({format:elem.attr("data-format"),interval:parseInt(elem.attr("data-intervals")),formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}})}),jQuery(".um-rating").raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,click:function(e,t){live_field=this.id,live_value=e,um_conditional()}}),jQuery(".um-rating-readonly").raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,readOnly:!0}),jQuery(document).on("click",".um .um-single-image-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),i=jQuery(this).parents(".um-field").find(".um-single-image-preview img").attr("src");return t.find(".um-single-image-preview img").attr("src",""),t.find(".um-single-image-preview").hide(),t.find(".um-btn-auto-width").html("Upload"),t.find("input[type=hidden]").val(""),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_remove_file",src:i}}),!1}),jQuery(document).on("click",".um .um-single-file-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),i=jQuery(this).parents(".um-field").find(".um-single-fileinfo a").attr("href");return t.find(".um-single-file-preview").hide(),t.find(".um-btn-auto-width").html("Upload"),t.find("input[type=hidden]").val(""),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_remove_file",src:i}}),!1}),jQuery(".um-s1").select2({allowClear:!0,minimumResultsForSearch:10}),jQuery(".um-s2").select2({allowClear:!1,minimumResultsForSearch:10}),jQuery(".um-s1,.um-s2").css({display:"block"}),jQuery(document).on("click",".um-field-group-head:not(.disabled)",function(){var e=jQuery(this).parents(".um-field-group"),t=e.data("max_entries");e.find(".um-field-group-body").is(":hidden")?e.find(".um-field-group-body").show():e.find(".um-field-group-body:first").clone().appendTo(e),increase_id=0,e.find(".um-field-group-body").each(function(){increase_id++,jQuery(this).find("input").each(function(){var e=jQuery(this);e.attr("id",e.data("key")+"-"+increase_id),e.attr("name",e.data("key")+"-"+increase_id),e.parent().parent().find("label").attr("for",e.data("key")+"-"+increase_id)})}),t>0&&e.find(".um-field-group-body").length==t&&jQuery(this).addClass("disabled")}),jQuery(document).on("click",".um-field-group-cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field-group"),i=t.data("max_entries");return t.find(".um-field-group-body").length>1?jQuery(this).parents(".um-field-group-body").remove():jQuery(this).parents(".um-field-group-body").hide(),i>0&&t.find(".um-field-group-body").length<i&&t.find(".um-field-group-head").removeClass("disabled"),!1}),jQuery(document).on("click",".um-ajax-paginate",function(e){e.preventDefault();var t=jQuery(this).parent();t.addClass("loading");var i=jQuery(this).data("args"),a=jQuery(this).data("hook"),n=jQuery(this).parents(".um").find(".um-ajax-items");return jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_ajax_paginate",hook:a,args:i},complete:function(){t.removeClass("loading")},success:function(e){t.remove(),n.append(e)}}),!1}),jQuery(document).on("click",".um-ajax-action",function(e){e.preventDefault();var t=jQuery(this).data("hook"),i=jQuery(this).data("user_id"),a=jQuery(this).data("arguments");return jQuery(this).data("js-remove")&&jQuery(this).parents("."+jQuery(this).data("js-remove")).fadeOut("fast"),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_muted_action",hook:t,user_id:i,arguments:a},success:function(e){}}),!1})}),jQuery(document).ready(function(){jQuery(".um-members").each(function(){UM_Member_Grid(jQuery(this))}),jQuery(".um-member-connect").each(function(){0==jQuery(this).find("a").length&&jQuery(this).remove()}),jQuery(".um-member-meta-main").each(function(){0==jQuery(this).find(".um-member-metaline").length&&0==jQuery(this).find(".um-member-connect").find("a").length&&jQuery(this).remove()}),jQuery(document).on("click",".um-member-more a",function(e){e.preventDefault();var t=jQuery(this).parents(".um-member"),i=jQuery(this).parents(".um-members");return t.find(".um-member-more").hide(),t.find(".um-member-meta").slideDown(function(){UM_Member_Grid(i)}),t.find(".um-member-less").fadeIn(),setTimeout(function(){UM_Member_Grid(i)},100),!1}),jQuery(document).on("click",".um-member-less a",function(e){e.preventDefault();var t=jQuery(this).parents(".um-member"),i=jQuery(this).parents(".um-members");return t.find(".um-member-less").hide(),t.find(".um-member-meta").slideUp(function(){t.find(".um-member-more").fadeIn(),UM_Member_Grid(i)}),!1}),jQuery(document).on("click",".um-do-search",function(e){return e.preventDefault(),jQuery(this).parents("form").submit(),!1})}),jQuery(document).ready(function(){function e(){if("undefined"!=typeof jQuery("textarea[id=um-meta-bio]").val()){var e=jQuery("textarea[id=um-meta-bio]").attr("data-character-limit"),t=e-jQuery("textarea[id=um-meta-bio]").val().length;jQuery("span.um-meta-bio-character span.um-bio-limit").text(t),5>t?jQuery("span.um-meta-bio-character").css("color","red"):jQuery("span.um-meta-bio-character").css("color","")}}jQuery(".um-profile.um-viewing .um-profile-body .um-row").each(function(){var e=jQuery(this);0==e.find(".um-field").length&&(e.prev(".um-row-heading").remove(),e.remove())}),jQuery(".um-profile.um-viewing .um-profile-body").length&&0==jQuery(".um-profile.um-viewing .um-profile-body").find(".um-field").length&&(jQuery(".um-row-heading,.um-row").remove(),jQuery(".um-profile-note").show()),jQuery(document).on("click",".um-profile-save",function(e){return e.preventDefault(),jQuery(this).parents(".um").find("form").submit(),!1}),jQuery(document).on("click",".um-profile-edit-a",function(e){jQuery(this).addClass("active")}),jQuery(document).on("click",".um-cover a, .um-photo a",function(e){return e.preventDefault(),!1}),jQuery(document).on("click",".um-photo-modal",function(e){e.preventDefault();var t=jQuery(this).attr("data-src");return um_new_modal("um_view_photo","fit",!0,t),!1}),jQuery(document).on("click",".um-reset-profile-photo",function(e){jQuery(".um-profile-photo-img img").attr("src",jQuery(this).attr("data-default_src")),user_id=jQuery(this).attr("data-user_id"),metakey="profile_photo",jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_delete_profile_photo",metakey:metakey,user_id:user_id}})}),jQuery(document).on("click",".um-reset-cover-photo",function(e){jQuery(".um-cover-overlay").hide(),jQuery(".um-cover-e").html('<a href="#" class="um-cover-add um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" title="Upload a cover photo"></i></span></a>'),jQuery(".um-dropdown").hide(),um_responsive(),user_id=jQuery(this).attr("data-user_id"),metakey="cover_photo",jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_delete_cover_photo",metakey:metakey,user_id:user_id}})}),e(),jQuery("textarea[id=um-meta-bio]").change(e),jQuery("textarea[id=um-meta-bio]").keyup(e)}),jQuery(document).ready(function(){var e=jQuery(".um-account-main").attr("data-current_tab");e&&jQuery(".um-account-tab[data-tab="+e+"]").show(),jQuery(document).on("click",".um-account-side li a",function(e){e.preventDefault();var t=jQuery(this);t.parents("ul").find("li a").removeClass("current"),t.addClass("current");var i=jQuery(this).attr("href"),a=jQuery(this).attr("data-tab");return window.history.pushState("","",i),jQuery(".um-account-tab").hide(),jQuery(".um-account-tab[data-tab="+a+"]").fadeIn(),jQuery(".um-account-nav a").removeClass("current"),jQuery(".um-account-nav a[data-tab="+a+"]").addClass("current"),!1}),jQuery(document).on("click",".um-account-nav a",function(e){e.preventDefault();var t=jQuery(this).attr("data-tab"),i=jQuery(this).parents("div"),a=jQuery(this);return jQuery(".um-account-tab").hide(),a.hasClass("current")?(i.next(".um-account-tab").slideUp(),a.removeClass("current")):(i.next(".um-account-tab").slideDown(),a.parents("div").find("a").removeClass("current"),a.addClass("current")),jQuery(".um-account-side li a").removeClass("current"),jQuery(".um-account-side li a[data-tab="+t+"]").addClass("current"),!1})});
4
var i=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)#x2F;i;return this.each(function(){var a=this.type,n=this.tagName.toLowerCase();i.test(a)||"textarea"==n?this.value="":"checkbox"==a||"radio"==a?this.checked=!1:"select"==n?this.selectedIndex=-1:"file"==a?/MSIE/.test(navigator.userAgent)?e(this).replaceWith(e(this).clone(!0)):e(this).val(""):t&&(t===!0&&/hidden/.test(a)||"string"==typeof t&&e(this).is(t))&&(this.value="")})},e.fn.resetForm=function(){return this.each(function(){("function"==typeof this.reset||"object"==typeof this.reset&&!this.reset.nodeType)&&this.reset()})},e.fn.enable=function(e){return void 0===e&&(e=!0),this.each(function(){this.disabled=!e})},e.fn.selected=function(t){return void 0===t&&(t=!0),this.each(function(){var i=this.type;if("checkbox"==i||"radio"==i)this.checked=t;else if("option"==this.tagName.toLowerCase()){var a=e(this).parent("select");t&&a[0]&&"select-one"==a[0].type&&a.find("option").selected(!1),this.selected=t}})},e.fn.ajaxSubmit.debug=!1}),function(e){void 0==e.fn.ajaxForm;var t={};t.fileapi=void 0!==e("<input type='file'/>").get(0).files,t.formdata=void 0!==window.FormData,e.fn.uploadFile=function(i){function a(){h.afterUploadAll&&!g&&(g=!0,function e(){0!=f.sCounter&&f.sCounter+f.fCounter==f.tCounter?(h.afterUploadAll(f),g=!1):window.setTimeout(e,100)}())}function n(t,i,a){a.on("dragenter",function(t){t.stopPropagation(),t.preventDefault(),e(this).css("border","2px dashed #ddd")}),a.on("dragover",function(e){e.stopPropagation(),e.preventDefault()}),a.on("drop",function(a){e(this).css("border","2px dashed #ddd"),a.preventDefault(),t.errorLog.html("");var n=a.originalEvent.dataTransfer.files;return!i.multiple&&n.length>1?void(i.showError&&e("<div class='um-error-block'>"+i.multiDragErrorStr+"</div>").appendTo(t.errorLog)):void(0!=i.onSelect(n)&&o(i,t,n))}),e(document).on("dragenter",function(e){e.stopPropagation(),e.preventDefault()}),e(document).on("dragover",function(e){e.stopPropagation(),e.preventDefault(),a.css("border","2px dashed #ddd")}),e(document).on("drop",function(e){e.stopPropagation(),e.preventDefault(),a.css("border","2px dashed #ddd")})}function r(t){var i=[];i="string"==jQuery.type(t)?t.split("&"):e.param(t).split("&");var a,n,r=i.length,o=[];for(a=0;r>a;a++)i[a]=i[a].replace(/\+/g," "),n=i[a].split("="),o.push([decodeURIComponent(n[0]),decodeURIComponent(n[1])]);return o}function o(t,i,a){for(var n=0;n<a.length;n++)if(s(i,t,a[n].name))if(-1!=t.maxFileSize&&a[n].size>t.maxFileSize)t.showError&&e("<div class='um-error-block'>"+t.sizeErrorStr+"</div>").appendTo(i.errorLog);else if(-1!=t.maxFileCount&&i.selectedFiles>=t.maxFileCount)t.showError&&e("<div class='um-error-block'>"+t.maxFileCountErrorStr+"</div>").appendTo(i.errorLog);else{i.selectedFiles++;var o=t,l=new FormData,c=t.fileName.replace("[]","");l.append(c,a[n]);var h=t.formData;if(h)for(var p=r(h),f=0;f<p.length;f++)p[f]&&l.append(p[f][0],p[f][1]);o.fileData=l;var m=new u(i,t),g="";g=t.showFileCounter?i.fileCounter+t.fileCounterStyle+a[n].name:a[n].name,m.filename.html(g);var v=e("<form style='display:block; position:absolute;left: 150px;' class='"+i.formGroup+"' method='"+t.method+"' action='"+t.url+"' enctype='"+t.enctype+"'></form>");v.appendTo("body");var y=[];y.push(a[n].name),d(v,o,m,y,i),i.fileCounter++}else t.showError&&e("<div class='um-error-block'>"+t.extErrorStr+"</div>").appendTo(i.errorLog)}function s(e,t,i){var a=t.allowedTypes.toLowerCase().split(","),n=i.split(".").pop().toLowerCase();return"*"!=t.allowedTypes&&jQuery.inArray(n,a)<0?!1:!0}function l(t,i){if(t.showFileCounter){var a=e(".upload-filename").length;i.fileCounter=a+1,e(".upload-filename").each(function(i,n){var r=e(this).html().split(t.fileCounterStyle),o=(parseInt(r[0])-1,a+t.fileCounterStyle+r[1]);e(this).html(o),a--})}}function c(i,a,n,r){var h="ajax-upload-id-"+(new Date).getTime(),p=e("<form method='"+n.method+"' action='"+n.url+"' enctype='"+n.enctype+"'></form>"),f="<input type='file' id='"+h+"' name='"+n.fileName+"'/>";n.multiple&&(n.fileName.indexOf("[]")!=n.fileName.length-2&&(n.fileName+="[]"),f="<input type='file' id='"+h+"' name='"+n.fileName+"' multiple/>");var m=e(f).appendTo(p);m.change(function(){i.errorLog.html("");var h=(n.allowedTypes.toLowerCase().split(","),[]);if(this.files){for(y=0;y<this.files.length;y++)h.push(this.files[y].name);if(0==n.onSelect(this.files))return}else{var f=e(this).val(),m=[];if(h.push(f),!s(i,n,f))return void(n.showError&&e("<div class='um-error-block'>"+n.extErrorStr+"</div>").appendTo(i.errorLog));if(m.push({name:f,size:"NA"}),0==n.onSelect(m))return}if(l(n,i),r.unbind("click"),p.hide(),c(i,a,n,r),p.addClass(a),t.fileapi&&t.formdata){p.removeClass(a);var g=this.files;o(n,i,g)}else{for(var v="",y=0;y<h.length;y++)v+=n.showFileCounter?i.fileCounter+n.fileCounterStyle+h[y]+"<br>":h[y]+"<br>",i.fileCounter++;if(-1!=n.maxFileCount&&i.selectedFiles+h.length>n.maxFileCount)return void(n.showError&&e("<div class='um-error-block'>"+n.maxFileCountErrorStr+"</div>").appendTo(i.errorLog));i.selectedFiles+=h.length;var b=new u(i,n);b.filename.html(v),d(p,n,b,h,i)}}),p.css({margin:0,padding:0});var g=e(r).width()+10;10==g&&(g=120);var v=r.height()+10;10==v&&(v=35),r.css({position:"relative",overflow:"hidden",cursor:"default"}),m.css({position:"absolute",cursor:"pointer",top:"0px",width:"100%",height:"34px",left:"0px","z-index":"100",opacity:"0.0",filter:"alpha(opacity=0)","-ms-filter":"alpha(opacity=0)","-khtml-opacity":"0.0","-moz-opacity":"0.0"}),p.appendTo(r)}function u(t,i){return this.statusbar=e("<div class='upload-statusbar'></div>"),this.filename=e("<div class='upload-filename'></div>").appendTo(this.statusbar),this.progressDiv=e("<div class='upload-progress'>").appendTo(this.statusbar).hide(),this.progressbar=e("<div class='upload-bar "+t.formGroup+"'></div>").appendTo(this.progressDiv),this.abort=e("<div class='upload-red "+t.formGroup+"'>"+i.abortStr+"</div>").appendTo(this.statusbar).hide(),this.cancel=e("<div class='upload-red'>"+i.cancelStr+"</div>").appendTo(this.statusbar).hide(),this.done=e("<div class='upload-green'>"+i.doneStr+"</div>").appendTo(this.statusbar).hide(),this.del=e("<div class='upload-red'>"+i.deletelStr+"</div>").appendTo(this.statusbar).hide(),t.errorLog.after(this.statusbar),this}function d(e,i,n,o,s){var c={cache:!1,contentType:!1,processData:!1,forceSync:!1,data:i.formData,formData:i.fileData,dataType:i.returnType,beforeSubmit:function(t,l,c){if(0!=i.onSubmit.call(this,o)){var u=i.dynamicFormData();if(u){var d=r(u);if(d)for(var h=0;h<d.length;h++)d[h]&&(void 0!=i.fileData?c.formData.append(d[h][0],d[h][1]):c.data[d[h][0]]=d[h][1])}return s.tCounter+=o.length,a(),!0}return n.statusbar.append("<div class='um-error-block'>"+i.uploadErrorStr+"</div>"),n.cancel.show(),e.remove(),n.cancel.click(function(){n.statusbar.remove()}),!1},beforeSend:function(e,a){n.progressDiv.show(),n.cancel.hide(),n.done.hide(),i.showAbort&&(n.abort.show(),n.abort.click(function(){e.abort(),s.selectedFiles-=o.length})),t.formdata?n.progressbar.width("1%"):n.progressbar.width("5%")},uploadProgress:function(e,t,a,r){r>98&&(r=98);var o=r+"%";r>1&&n.progressbar.width(o),i.showProgress&&(n.progressbar.html(o),n.progressbar.css("text-align","center"))},success:function(t,a,r){s.responses.push(t),n.progressbar.width("100%"),i.showProgress&&(n.progressbar.html("100%"),n.progressbar.css("text-align","center")),n.abort.hide(),i.onSuccess.call(this,o,t,r),i.showStatusAfterSuccess?(i.showDone?(n.done.show(),n.done.click(function(){n.statusbar.hide("slow"),n.statusbar.remove()})):n.done.hide(),i.showDelete?(n.del.show(),n.del.click(function(){n.statusbar.hide().remove(),i.deleteCallback&&i.deleteCallback.call(this,t,n),s.selectedFiles-=o.length,l(i,s)})):n.del.hide()):(n.statusbar.hide("slow"),n.statusbar.remove()),e.remove(),s.sCounter+=o.length},error:function(t,a,r){n.abort.hide(),"abort"==t.statusText?(n.statusbar.hide("slow").remove(),l(i,s)):(i.onError.call(this,o,a,r),i.showStatusAfterError?(n.progressDiv.hide(),n.statusbar.append("<span class='um-error-block'>ERROR: "+r+"</span>")):(n.statusbar.hide(),n.statusbar.remove()),s.selectedFiles-=o.length),e.remove(),s.fCounter+=o.length}};i.autoSubmit?e.ajaxSubmit(c):(i.showCancel&&(n.cancel.show(),n.cancel.click(function(){e.remove(),n.statusbar.remove(),s.selectedFiles-=o.length,l(i,s)})),e.ajaxForm(c))}var h=e.extend({url:"",method:"POST",enctype:"multipart/form-data",formData:null,returnType:null,allowedTypes:"*",fileName:"file",formData:{},dynamicFormData:function(){return{}},maxFileSize:-1,maxFileCount:-1,multiple:!0,dragDrop:!0,autoSubmit:!0,showCancel:!0,showAbort:!0,showDone:!0,showDelete:!1,showError:!0,showStatusAfterSuccess:!0,showStatusAfterError:!0,showFileCounter:!0,fileCounterStyle:"). ",showProgress:!1,onSelect:function(e){return!0},onSubmit:function(e,t){},onSuccess:function(e,t,i){},onError:function(e,t,i){},deleteCallback:!1,afterUploadAll:!1,uploadButtonClass:"upload",dragDropStr:"",abortStr:"Abort",cancelStr:"Cancel",deletelStr:"Delete",doneStr:"Done",multiDragErrorStr:"Multiple File Drag &amp; Drop is not allowed.",extErrorStr:"",sizeErrorStr:"",uploadErrorStr:"Upload is not allowed",maxFileCountErrorStr:""},i);this.fileCounter=1,this.selectedFiles=0,this.fCounter=0,this.sCounter=0,this.tCounter=0;var p="upload-"+(new Date).getTime();this.formGroup=p,this.hide(),this.errorLog=e("<div></div>"),this.after(this.errorLog),this.responses=[],t.formdata||(h.dragDrop=!1),t.formdata||(h.multiple=!1);var f=this,m=e("<div>"+e(this).html()+"</div>");e(m).addClass(h.uploadButtonClass),function v(){if(e.fn.ajaxForm){if(h.dragDrop){var t=e('<div class="ajax-upload-dragdrop" style="vertical-align:top;"></div>');e(f).before(t),e(t).append(m),e(t).prepend(e(h.dragDropStr)),n(f,h,t)}else e(f).before(m);c(f,p,h,m)}else window.setTimeout(v,10)}(),this.startUpload=function(){e("."+this.formGroup).each(function(t,i){e(this).is("form")&&e(this).submit()})},this.stopUpload=function(){e(".upload-red").each(function(t,i){e(this).hasClass(f.formGroup)&&e(this).click()})},this.getResponses=function(){return this.responses};var g=!1;return this}}(jQuery),function(e){"function"==typeof define&&define.amd?define("picker",["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):this.Picker=e(jQuery)}(function(e){function t(r,o,l,h){function p(){return t._.node("div",t._.node("div",t._.node("div",t._.node("div",Q.component.nodes(_.open),S.box),S.wrap),S.frame),S.holder,'tabindex="-1"')}function f(){j.data(o,Q).addClass(S.input).val(j.data("value")?Q.get("select",C.format):r.value),C.editable||j.on("focus."+_.id+" click."+_.id,function(e){e.preventDefault(),Q.open()}).on("keydown."+_.id,w),n(r,{haspopup:!0,expanded:!1,readonly:!1,owns:r.id+"_root"})}function m(){n(Q.$root[0],"hidden",!0)}function g(){Q.$holder.on({keydown:w,"focus.toOpen":b,blur:function(){j.removeClass(S.target)},focusin:function(e){Q.$root.removeClass(S.focused),e.stopPropagation()},"mousedown click":function(t){var i=t.target;i!=Q.$holder[0]&&(t.stopPropagation(),"mousedown"!=t.type||e(i).is("input, select, textarea, button, option")||(t.preventDefault(),Q.$holder[0].focus()))}}).on("click","[data-pick], [data-nav], [data-clear], [data-close]",function(){var t=e(this),i=t.data(),a=t.hasClass(S.navDisabled)||t.hasClass(S.disabled),n=s();n=n&&(n.type||n.href),(a||n&&!e.contains(Q.$root[0],n))&&Q.$holder[0].focus(),!a&&i.nav?Q.set("highlight",Q.component.item.highlight,{nav:i.nav}):!a&&"pick"in i?(Q.set("select",i.pick),C.closeOnSelect&&Q.close(!0)):i.clear?(Q.clear(),C.closeOnClear&&Q.close(!0)):i.close&&Q.close(!0)})}function v(){var t;C.hiddenName===!0?(t=r.name,r.name=""):(t=["string"==typeof C.hiddenPrefix?C.hiddenPrefix:"","string"==typeof C.hiddenSuffix?C.hiddenSuffix:"_submit"],t=t[0]+r.name+t[1]),Q._hidden=e('<input type=hidden name="'+t+'"'+(j.data("value")||r.value?' value="'+Q.get("select",C.formatSubmit)+'"':"")+">")[0],j.on("change."+_.id,function(){Q._hidden.value=r.value?Q.get("select",C.formatSubmit):""})}function y(){x&&d?Q.$holder.find("."+S.frame).one("transitionend",function(){Q.$holder[0].focus()}):Q.$holder[0].focus()}function b(e){e.stopPropagation(),j.addClass(S.target),Q.$root.addClass(S.focused),Q.open()}function w(e){var t=e.keyCode,i=/^(8|46)#x2F;.test(t);return 27==t?(Q.close(!0),!1):void((32==t||i||!_.open&&Q.component.key[t])&&(e.preventDefault(),e.stopPropagation(),i?Q.clear().close():Q.open()))}if(!r)return t;var x=!1,_={id:r.id||"P"+Math.abs(~~(Math.random()*new Date))},C=l?e.extend(!0,{},l.defaults,h):h||{},S=e.extend({},t.klasses(),C.klass),j=e(r),k=function(){return this.start()},Q=k.prototype={constructor:k,$node:j,start:function(){return _&&_.start?Q:(_.methods={},_.start=!0,_.open=!1,_.type=r.type,r.autofocus=r==s(),r.readOnly=!C.editable,r.id=r.id||_.id,"text"!=r.type&&(r.type="text"),Q.component=new l(Q,C),Q.$root=e('<div class="'+S.picker+'" id="'+r.id+'_root" />'),m(),Q.$holder=e(p()).appendTo(Q.$root),g(),C.formatSubmit&&v(),f(),C.containerHidden?e(C.containerHidden).append(Q._hidden):j.after(Q._hidden),C.container?e(C.container).append(Q.$root):j.after(Q.$root),Q.on({start:Q.component.onStart,render:Q.component.onRender,stop:Q.component.onStop,open:Q.component.onOpen,close:Q.component.onClose,set:Q.component.onSet}).on({start:C.onStart,render:C.onRender,stop:C.onStop,open:C.onOpen,close:C.onClose,set:C.onSet}),x=i(Q.$holder[0]),r.autofocus&&Q.open(),Q.trigger("start").trigger("render"))},render:function(t){return t?(Q.$holder=e(p()),g(),Q.$root.html(Q.$holder)):Q.$root.find("."+S.box).html(Q.component.nodes(_.open)),Q.trigger("render")},stop:function(){return _.start?(Q.close(),Q._hidden&&Q._hidden.parentNode.removeChild(Q._hidden),Q.$root.remove(),j.removeClass(S.input).removeData(o),setTimeout(function(){j.off("."+_.id)},0),r.type=_.type,r.readOnly=!1,Q.trigger("stop"),_.methods={},_.start=!1,Q):Q},open:function(i){return _.open?Q:(j.addClass(S.active),n(r,"expanded",!0),setTimeout(function(){Q.$root.addClass(S.opened),n(Q.$root[0],"hidden",!1)},0),i!==!1&&(_.open=!0,x&&u.css("overflow","hidden").css("padding-right","+="+a()),y(),c.on("click."+_.id+" focusin."+_.id,function(e){var t=e.target;t!=r&&t!=document&&3!=e.which&&Q.close(t===Q.$holder[0])}).on("keydown."+_.id,function(i){var a=i.keyCode,n=Q.component.key[a],r=i.target;27==a?Q.close(!0):r!=Q.$holder[0]||!n&&13!=a?e.contains(Q.$root[0],r)&&13==a&&(i.preventDefault(),r.click()):(i.preventDefault(),n?t._.trigger(Q.component.key.go,Q,[t._.trigger(n)]):Q.$root.find("."+S.highlighted).hasClass(S.disabled)||(Q.set("select",Q.component.item.highlight),C.closeOnSelect&&Q.close(!0)))})),Q.trigger("open"))},close:function(e){return e&&(C.editable?r.focus():(Q.$holder.off("focus.toOpen").focus(),setTimeout(function(){Q.$holder.on("focus.toOpen",b)},0))),j.removeClass(S.active),n(r,"expanded",!1),setTimeout(function(){Q.$root.removeClass(S.opened+" "+S.focused),n(Q.$root[0],"hidden",!0)},0),_.open?(_.open=!1,x&&u.css("overflow","").css("padding-right","-="+a()),c.off("."+_.id),Q.trigger("close")):Q},clear:function(e){return Q.set("clear",null,e)},set:function(t,i,a){var n,r,o=e.isPlainObject(t),s=o?t:{};if(a=o&&e.isPlainObject(i)?i:a||{},t){o||(s[t]=i);for(n in s)r=s[n],n in Q.component.item&&(void 0===r&&(r=null),Q.component.set(n,r,a)),("select"==n||"clear"==n)&&j.val("clear"==n?"":Q.get(n,C.format)).trigger("change");Q.render()}return a.muted?Q:Q.trigger("set",s)},get:function(e,i){if(e=e||"value",null!=_[e])return _[e];if("valueSubmit"==e){if(Q._hidden)return Q._hidden.value;e="value"}if("value"==e)return r.value;if(e in Q.component.item){if("string"==typeof i){var a=Q.component.get(e);return a?t._.trigger(Q.component.formats.toString,Q.component,[i,a]):""}return Q.component.get(e)}},on:function(t,i,a){var n,r,o=e.isPlainObject(t),s=o?t:{};if(t){o||(s[t]=i);for(n in s)r=s[n],a&&(n="_"+n),_.methods[n]=_.methods[n]||[],_.methods[n].push(r)}return Q},off:function(){var e,t,i=arguments;for(e=0,namesCount=i.length;e<namesCount;e+=1)t=i[e],t in _.methods&&delete _.methods[t];return Q},trigger:function(e,i){var a=function(e){var a=_.methods[e];a&&a.map(function(e){t._.trigger(e,Q,[i])})};return a("_"+e),a(e),Q}};return new k}function i(e){var t,i="position";return e.currentStyle?t=e.currentStyle[i]:window.getComputedStyle&&(t=getComputedStyle(e)[i]),"fixed"==t}function a(){if(u.height()<=l.height())return 0;var t=e('<div style="visibility:hidden;width:100px" />').appendTo("body"),i=t[0].offsetWidth;t.css("overflow","scroll");var a=e('<div style="width:100%" />').appendTo(t),n=a[0].offsetWidth;return t.remove(),i-n}function n(t,i,a){if(e.isPlainObject(i))for(var n in i)r(t,n,i[n]);else r(t,i,a)}function r(e,t,i){e.setAttribute(("role"==t?"":"aria-")+t,i)}function o(t,i){e.isPlainObject(t)||(t={attribute:i}),i="";for(var a in t){var n=("role"==a?"":"aria-")+a,r=t[a];i+=null==r?"":n+'="'+t[a]+'"'}return i}function s(){try{return document.activeElement}catch(e){}}var l=e(window),c=e(document),u=e(document.documentElement),d=null!=document.documentElement.style.transition;return t.klasses=function(e){return e=e||"picker",{picker:e,opened:e+"--opened",focused:e+"--focused",input:e+"__input",active:e+"__input--active",target:e+"__input--target",holder:e+"__holder",frame:e+"__frame",wrap:e+"__wrap",box:e+"__box"}},t._={group:function(e){for(var i,a="",n=t._.trigger(e.min,e);n<=t._.trigger(e.max,e,[n]);n+=e.i)i=t._.trigger(e.item,e,[n]),a+=t._.node(e.node,i[0],i[1],i[2]);return a},node:function(t,i,a,n){return i?(i=e.isArray(i)?i.join(""):i,a=a?' class="'+a+'"':"",n=n?" "+n:"","<"+t+a+n+">"+i+"</"+t+">"):""},lead:function(e){return(10>e?"0":"")+e},trigger:function(e,t,i){return"function"==typeof e?e.apply(t,i||[]):e},digits:function(e){return/\d/.test(e[1])?2:1},isDate:function(e){return{}.toString.call(e).indexOf("Date")>-1&&this.isInteger(e.getDate())},isInteger:function(e){return{}.toString.call(e).indexOf("Number")>-1&&e%1===0},ariaAttr:o},t.extend=function(i,a){e.fn[i]=function(n,r){var o=this.data(i);return"picker"==n?o:o&&"string"==typeof n?t._.trigger(o[n],o,[r]):this.each(function(){var r=e(this);r.data(i)||new t(this,i,a,n)})},e.fn[i].defaults=a.defaults},t}),function(e){"function"==typeof define&&define.amd?define(["picker","jquery"],e):"object"==typeof exports?module.exports=e(require("./picker.js"),require("jquery")):e(Picker,jQuery)}(function(e,t){function i(e,t){var i=this,a=e.$node[0],n=a.value,r=e.$node.data("value"),o=r||n,s=r?t.formatSubmit:t.format,l=function(){return a.currentStyle?"rtl"==a.currentStyle.direction:"rtl"==getComputedStyle(e.$root[0]).direction};i.settings=t,i.$node=e.$node,i.queue={min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse navigate create validate",view:"parse create validate viewset",disable:"deactivate",enable:"activate"},i.item={},i.item.clear=null,i.item.disable=(t.disable||[]).slice(0),i.item.enable=-function(e){return e[0]===!0?e.shift():-1}(i.item.disable),i.set("min",t.min).set("max",t.max).set("now"),o?i.set("select",o,{format:s,defaultValue:!0}):i.set("select",null).set("highlight",i.item.now),i.key={40:7,38:-7,39:function(){return l()?-1:1},37:function(){return l()?1:-1},go:function(e){var t=i.item.highlight,a=new Date(t.year,t.month,t.date+e);i.set("highlight",a,{interval:e}),this.render()}},e.on("render",function(){e.$root.find("."+t.klass.selectMonth).on("change",function(){var i=this.value;i&&(e.set("highlight",[e.get("view").year,i,e.get("highlight").date]),e.$root.find("."+t.klass.selectMonth).trigger("focus"))}),e.$root.find("."+t.klass.selectYear).on("change",function(){var i=this.value;i&&(e.set("highlight",[i,e.get("view").month,e.get("highlight").date]),e.$root.find("."+t.klass.selectYear).trigger("focus"))})},1).on("open",function(){var a="";i.disabled(i.get("now"))&&(a=":not(."+t.klass.buttonToday+")"),e.$root.find("button"+a+", select").attr("disabled",!1)},1).on("close",function(){e.$root.find("button, select").attr("disabled",!0)},1)}var a=7,n=6,r=e._;i.prototype.set=function(e,t,i){var a=this,n=a.item;return null===t?("clear"==e&&(e="select"),n[e]=t,a):(n["enable"==e?"disable":"flip"==e?"enable":e]=a.queue[e].split(" ").map(function(n){return t=a[n](e,t,i)}).pop(),"select"==e?a.set("highlight",n.select,i):"highlight"==e?a.set("view",n.highlight,i):e.match(/^(flip|min|max|disable|enable)#x2F;)&&(n.select&&a.disabled(n.select)&&a.set("select",n.select,i),n.highlight&&a.disabled(n.highlight)&&a.set("highlight",n.highlight,i)),a)},i.prototype.get=function(e){return this.item[e]},i.prototype.create=function(e,i,a){var n,o=this;return i=void 0===i?e:i,i==-(1/0)||i==1/0?n=i:t.isPlainObject(i)&&r.isInteger(i.pick)?i=i.obj:t.isArray(i)?(i=new Date(i[0],i[1],i[2]),i=r.isDate(i)?i:o.create().obj):i=r.isInteger(i)||r.isDate(i)?o.normalize(new Date(i),a):o.now(e,i,a),{year:n||i.getFullYear(),month:n||i.getMonth(),date:n||i.getDate(),day:n||i.getDay(),obj:n||i,pick:n||i.getTime()}},i.prototype.createRange=function(e,i){var a=this,n=function(e){return e===!0||t.isArray(e)||r.isDate(e)?a.create(e):e};return r.isInteger(e)||(e=n(e)),r.isInteger(i)||(i=n(i)),r.isInteger(e)&&t.isPlainObject(i)?e=[i.year,i.month,i.date+e]:r.isInteger(i)&&t.isPlainObject(e)&&(i=[e.year,e.month,e.date+i]),{from:n(e),to:n(i)}},i.prototype.withinRange=function(e,t){return e=this.createRange(e.from,e.to),t.pick>=e.from.pick&&t.pick<=e.to.pick},i.prototype.overlapRanges=function(e,t){var i=this;return e=i.createRange(e.from,e.to),t=i.createRange(t.from,t.to),i.withinRange(e,t.from)||i.withinRange(e,t.to)||i.withinRange(t,e.from)||i.withinRange(t,e.to)},i.prototype.now=function(e,t,i){return t=new Date,i&&i.rel&&t.setDate(t.getDate()+i.rel),this.normalize(t,i)},i.prototype.navigate=function(e,i,a){var n,r,o,s,l=t.isArray(i),c=t.isPlainObject(i),u=this.item.view;if(l||c){for(c?(r=i.year,o=i.month,s=i.date):(r=+i[0],o=+i[1],s=+i[2]),a&&a.nav&&u&&u.month!==o&&(r=u.year,o=u.month),n=new Date(r,o+(a&&a.nav?a.nav:0),1),r=n.getFullYear(),o=n.getMonth();new Date(r,o,s).getMonth()!==o;)s-=1;i=[r,o,s]}return i},i.prototype.normalize=function(e){return e.setHours(0,0,0,0),e},i.prototype.measure=function(e,t){var i=this;return t?"string"==typeof t?t=i.parse(e,t):r.isInteger(t)&&(t=i.now(e,t,{rel:t})):t="min"==e?-(1/0):1/0,t},i.prototype.viewset=function(e,t){return this.create([t.year,t.month,1])},i.prototype.validate=function(e,i,a){var n,o,s,l,c=this,u=i,d=a&&a.interval?a.interval:1,h=-1===c.item.enable,p=c.item.min,f=c.item.max,m=h&&c.item.disable.filter(function(e){if(t.isArray(e)){var a=c.create(e).pick;a<i.pick?n=!0:a>i.pick&&(o=!0)}return r.isInteger(e)}).length;if((!a||!a.nav&&!a.defaultValue)&&(!h&&c.disabled(i)||h&&c.disabled(i)&&(m||n||o)||!h&&(i.pick<=p.pick||i.pick>=f.pick)))for(h&&!m&&(!o&&d>0||!n&&0>d)&&(d*=-1);c.disabled(i)&&(Math.abs(d)>1&&(i.month<u.month||i.month>u.month)&&(i=u,d=d>0?1:-1),i.pick<=p.pick?(s=!0,d=1,i=c.create([p.year,p.month,p.date+(i.pick===p.pick?0:-1)])):i.pick>=f.pick&&(l=!0,d=-1,i=c.create([f.year,f.month,f.date+(i.pick===f.pick?0:1)])),!s||!l);)i=c.create([i.year,i.month,i.date+d]);return i},i.prototype.disabled=function(e){var i=this,a=i.item.disable.filter(function(a){return r.isInteger(a)?e.day===(i.settings.firstDay?a:a-1)%7:t.isArray(a)||r.isDate(a)?e.pick===i.create(a).pick:t.isPlainObject(a)?i.withinRange(a,e):void 0});return a=a.length&&!a.filter(function(e){return t.isArray(e)&&"inverted"==e[3]||t.isPlainObject(e)&&e.inverted}).length,-1===i.item.enable?!a:a||e.pick<i.item.min.pick||e.pick>i.item.max.pick},i.prototype.parse=function(e,t,i){var a=this,n={};return t&&"string"==typeof t?(i&&i.format||(i=i||{},i.format=a.settings.format),a.formats.toArray(i.format).map(function(e){var i=a.formats[e],o=i?r.trigger(i,a,[t,n]):e.replace(/^!/,"").length;i&&(n[e]=t.substr(0,o)),t=t.substr(o)}),[n.yyyy||n.yy,+(n.mm||n.m)-1,n.dd||n.d]):t},i.prototype.formats=function(){function e(e,t,i){var a=e.match(/[^\x00-\x7F]+|\w+/)[0];return i.mm||i.m||(i.m=t.indexOf(a)+1),a.length}function t(e){return e.match(/\w+/)[0].length}return{d:function(e,t){return e?r.digits(e):t.date},dd:function(e,t){return e?2:r.lead(t.date)},ddd:function(e,i){return e?t(e):this.settings.weekdaysShort[i.day]},dddd:function(e,i){return e?t(e):this.settings.weekdaysFull[i.day]},m:function(e,t){return e?r.digits(e):t.month+1},mm:function(e,t){return e?2:r.lead(t.month+1)},mmm:function(t,i){var a=this.settings.monthsShort;return t?e(t,a,i):a[i.month]},mmmm:function(t,i){var a=this.settings.monthsFull;return t?e(t,a,i):a[i.month]},yy:function(e,t){return e?2:(""+t.year).slice(2)},yyyy:function(e,t){return e?4:t.year},toArray:function(e){return e.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g)},toString:function(e,t){var i=this;return i.formats.toArray(e).map(function(e){return r.trigger(i.formats[e],i,[0,t])||e.replace(/^!/,"")}).join("")}}}(),i.prototype.isDateExact=function(e,i){var a=this;return r.isInteger(e)&&r.isInteger(i)||"boolean"==typeof e&&"boolean"==typeof i?e===i:(r.isDate(e)||t.isArray(e))&&(r.isDate(i)||t.isArray(i))?a.create(e).pick===a.create(i).pick:t.isPlainObject(e)&&t.isPlainObject(i)?a.isDateExact(e.from,i.from)&&a.isDateExact(e.to,i.to):!1},i.prototype.isDateOverlap=function(e,i){var a=this,n=a.settings.firstDay?1:0;return r.isInteger(e)&&(r.isDate(i)||t.isArray(i))?(e=e%7+n,e===a.create(i).day+1):r.isInteger(i)&&(r.isDate(e)||t.isArray(e))?(i=i%7+n,i===a.create(e).day+1):t.isPlainObject(e)&&t.isPlainObject(i)?a.overlapRanges(e,i):!1},i.prototype.flipEnable=function(e){var t=this.item;t.enable=e||(-1==t.enable?1:-1)},i.prototype.deactivate=function(e,i){var a=this,n=a.item.disable.slice(0);return"flip"==i?a.flipEnable():i===!1?(a.flipEnable(1),n=[]):i===!0?(a.flipEnable(-1),n=[]):i.map(function(e){for(var i,o=0;o<n.length;o+=1)if(a.isDateExact(e,n[o])){i=!0;break}i||(r.isInteger(e)||r.isDate(e)||t.isArray(e)||t.isPlainObject(e)&&e.from&&e.to)&&n.push(e)}),n},i.prototype.activate=function(e,i){var a=this,n=a.item.disable,o=n.length;return"flip"==i?a.flipEnable():i===!0?(a.flipEnable(1),n=[]):i===!1?(a.flipEnable(-1),n=[]):i.map(function(e){var i,s,l,c;for(l=0;o>l;l+=1){if(s=n[l],a.isDateExact(s,e)){i=n[l]=null,c=!0;break}if(a.isDateOverlap(s,e)){t.isPlainObject(e)?(e.inverted=!0,i=e):t.isArray(e)?(i=e,i[3]||i.push("inverted")):r.isDate(e)&&(i=[e.getFullYear(),e.getMonth(),e.getDate(),"inverted"]);break}}if(i)for(l=0;o>l;l+=1)if(a.isDateExact(n[l],e)){n[l]=null;break}if(c)for(l=0;o>l;l+=1)if(a.isDateOverlap(n[l],e)){n[l]=null;break}i&&n.push(i)}),n.filter(function(e){return null!=e})},i.prototype.nodes=function(e){var t=this,i=t.settings,o=t.item,s=o.now,l=o.select,c=o.highlight,u=o.view,d=o.disable,h=o.min,p=o.max,f=function(e,t){return i.firstDay&&(e.push(e.shift()),t.push(t.shift())),r.node("thead",r.node("tr",r.group({min:0,max:a-1,i:1,node:"th",item:function(a){return[e[a],i.klass.weekdays,'scope=col title="'+t[a]+'"']}})))}((i.showWeekdaysFull?i.weekdaysFull:i.weekdaysShort).slice(0),i.weekdaysFull.slice(0)),m=function(e){return r.node("div"," ",i.klass["nav"+(e?"Next":"Prev")]+(e&&u.year>=p.year&&u.month>=p.month||!e&&u.year<=h.year&&u.month<=h.month?" "+i.klass.navDisabled:""),"data-nav="+(e||-1)+" "+r.ariaAttr({role:"button",controls:t.$node[0].id+"_table"})+' title="'+(e?i.labelMonthNext:i.labelMonthPrev)+'"')},g=function(){var a=i.showMonthsShort?i.monthsShort:i.monthsFull;return i.selectMonths?r.node("select",r.group({min:0,max:11,i:1,node:"option",item:function(e){return[a[e],0,"value="+e+(u.month==e?" selected":"")+(u.year==h.year&&e<h.month||u.year==p.year&&e>p.month?" disabled":"")]}}),i.klass.selectMonth,(e?"":"disabled")+" "+r.ariaAttr({controls:t.$node[0].id+"_table"})+' title="'+i.labelMonthSelect+'"'):r.node("div",a[u.month],i.klass.month)},v=function(){var a=u.year,n=i.selectYears===!0?5:~~(i.selectYears/2);if(n){var o=h.year,s=p.year,l=a-n,c=a+n;if(o>l&&(c+=o-l,l=o),c>s){var d=l-o,f=c-s;l-=d>f?f:d,c=s}return r.node("select",r.group({min:l,max:c,i:1,node:"option",item:function(e){return[e,0,"value="+e+(a==e?" selected":"")]}}),i.klass.selectYear,(e?"":"disabled")+" "+r.ariaAttr({controls:t.$node[0].id+"_table"})+' title="'+i.labelYearSelect+'"')}return r.node("div",a,i.klass.year)};return r.node("div",(i.selectYears?v()+g():g()+v())+m()+m(1),i.klass.header)+r.node("table",f+r.node("tbody",r.group({min:0,max:n-1,i:1,node:"tr",item:function(e){var n=i.firstDay&&0===t.create([u.year,u.month,1]).day?-7:0;return[r.group({min:a*e-u.day+n+1,max:function(){return this.min+a-1},i:1,node:"td",item:function(e){e=t.create([u.year,u.month,e+(i.firstDay?1:0)]);var a=l&&l.pick==e.pick,n=c&&c.pick==e.pick,o=d&&t.disabled(e)||e.pick<h.pick||e.pick>p.pick,f=r.trigger(t.formats.toString,t,[i.format,e]);return[r.node("div",e.date,function(t){return t.push(u.month==e.month?i.klass.infocus:i.klass.outfocus),s.pick==e.pick&&t.push(i.klass.now),a&&t.push(i.klass.selected),n&&t.push(i.klass.highlighted),o&&t.push(i.klass.disabled),t.join(" ")}([i.klass.day]),"data-pick="+e.pick+" "+r.ariaAttr({role:"gridcell",label:f,selected:a&&t.$node.val()===f?!0:null,activedescendant:n?!0:null,disabled:o?!0:null})),"",r.ariaAttr({role:"presentation"})]}})]}})),i.klass.table,'id="'+t.$node[0].id+'_table" '+r.ariaAttr({role:"grid",controls:t.$node[0].id,readonly:!0}))+r.node("div",r.node("button",i.today,i.klass.buttonToday,"type=button data-pick="+s.pick+(e&&!t.disabled(s)?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id}))+r.node("button",i.clear,i.klass.buttonClear,"type=button data-clear=1"+(e?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id}))+r.node("button",i.close,i.klass.buttonClose,"type=button data-close=true "+(e?"":" disabled")+" "+r.ariaAttr({controls:t.$node[0].id})),i.klass.footer)},i.defaults=function(e){return{labelMonthNext:"Next month",labelMonthPrev:"Previous month",labelMonthSelect:"Select a month",labelYearSelect:"Select a year",monthsFull:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdaysFull:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],today:"Today",clear:"Clear",close:"Close",closeOnSelect:!0,closeOnClear:!0,format:"d mmmm, yyyy",klass:{table:e+"table",header:e+"header",navPrev:e+"nav--prev",navNext:e+"nav--next",navDisabled:e+"nav--disabled",month:e+"month",year:e+"year",selectMonth:e+"select--month",selectYear:e+"select--year",weekdays:e+"weekday",day:e+"day",disabled:e+"day--disabled",selected:e+"day--selected",highlighted:e+"day--highlighted",now:e+"day--today",infocus:e+"day--infocus",outfocus:e+"day--outfocus",footer:e+"footer",buttonClear:e+"button--clear",buttonToday:e+"button--today",buttonClose:e+"button--close"}}}(e.klasses().picker+"__"),e.extend("pickadate",i)}),function(e){"function"==typeof define&&define.amd?define(["picker","jquery"],e):"object"==typeof exports?module.exports=e(require("./picker.js"),require("jquery")):e(Picker,jQuery)}(function(e,t){function i(e,t){var i=this,a=e.$node[0].value,n=e.$node.data("value"),r=n||a,o=n?t.formatSubmit:t.format;i.settings=t,i.$node=e.$node,i.queue={interval:"i",min:"measure create",max:"measure create",now:"now create",select:"parse create validate",highlight:"parse create validate",view:"parse create validate",disable:"deactivate",enable:"activate"},i.item={},i.item.clear=null,i.item.interval=t.interval||30,i.item.disable=(t.disable||[]).slice(0),i.item.enable=-function(e){return e[0]===!0?e.shift():-1}(i.item.disable),i.set("min",t.min).set("max",t.max).set("now"),r?i.set("select",r,{format:o}):i.set("select",null).set("highlight",i.item.now),i.key={40:1,38:-1,39:1,37:-1,go:function(e){i.set("highlight",i.item.highlight.pick+e*i.item.interval,{interval:e*i.item.interval}),this.render()}},e.on("render",function(){var i=e.$root.children(),a=i.find("."+t.klass.viewset),n=function(e){return["webkit","moz","ms","o",""].map(function(t){
5
return(t?"-"+t+"-":"")+e})},r=function(e,t){n("transform").map(function(i){e.css(i,t)}),n("transition").map(function(i){e.css(i,t)})};a.length&&(r(i,"none"),i[0].scrollTop=~~a.position().top-2*a[0].clientHeight,r(i,""))},1).on("open",function(){e.$root.find("button").attr("disabled",!1)},1).on("close",function(){e.$root.find("button").attr("disabled",!0)},1)}var a=24,n=60,r=12,o=a*n,s=e._;i.prototype.set=function(e,t,i){var a=this,n=a.item;return null===t?("clear"==e&&(e="select"),n[e]=t,a):(n["enable"==e?"disable":"flip"==e?"enable":e]=a.queue[e].split(" ").map(function(n){return t=a[n](e,t,i)}).pop(),"select"==e?a.set("highlight",n.select,i):"highlight"==e?a.set("view",n.highlight,i):"interval"==e?a.set("min",n.min,i).set("max",n.max,i):e.match(/^(flip|min|max|disable|enable)#x2F;)&&(n.select&&a.disabled(n.select)&&a.set("select",t,i),n.highlight&&a.disabled(n.highlight)&&a.set("highlight",t,i),"min"==e&&a.set("max",n.max,i)),a)},i.prototype.get=function(e){return this.item[e]},i.prototype.create=function(e,i,r){var l=this;return i=void 0===i?e:i,s.isDate(i)&&(i=[i.getHours(),i.getMinutes()]),t.isPlainObject(i)&&s.isInteger(i.pick)?i=i.pick:t.isArray(i)?i=+i[0]*n+ +i[1]:s.isInteger(i)||(i=l.now(e,i,r)),"max"==e&&i<l.item.min.pick&&(i+=o),"min"!=e&&"max"!=e&&(i-l.item.min.pick)%l.item.interval!==0&&(i+=l.item.interval),i=l.normalize(e,i,r),{hour:~~(a+i/n)%a,mins:(n+i%n)%n,time:(o+i)%o,pick:i%o}},i.prototype.createRange=function(e,i){var a=this,n=function(e){return e===!0||t.isArray(e)||s.isDate(e)?a.create(e):e};return s.isInteger(e)||(e=n(e)),s.isInteger(i)||(i=n(i)),s.isInteger(e)&&t.isPlainObject(i)?e=[i.hour,i.mins+e*a.settings.interval]:s.isInteger(i)&&t.isPlainObject(e)&&(i=[e.hour,e.mins+i*a.settings.interval]),{from:n(e),to:n(i)}},i.prototype.withinRange=function(e,t){return e=this.createRange(e.from,e.to),t.pick>=e.from.pick&&t.pick<=e.to.pick},i.prototype.overlapRanges=function(e,t){var i=this;return e=i.createRange(e.from,e.to),t=i.createRange(t.from,t.to),i.withinRange(e,t.from)||i.withinRange(e,t.to)||i.withinRange(t,e.from)||i.withinRange(t,e.to)},i.prototype.now=function(e,t){var i,a=this.item.interval,r=new Date,o=r.getHours()*n+r.getMinutes(),l=s.isInteger(t);return o-=o%a,i=0>t&&-a>=a*t+o,o+="min"==e&&i?0:a,l&&(o+=a*(i&&"max"!=e?t+1:t)),o},i.prototype.normalize=function(e,t){var i=this.item.interval,a=this.item.min&&this.item.min.pick||0;return t-="min"==e?0:(t-a)%i},i.prototype.measure=function(e,i,r){var o=this;return i||(i="min"==e?[0,0]:[a-1,n-1]),"string"==typeof i?i=o.parse(e,i):i===!0||s.isInteger(i)?i=o.now(e,i,r):t.isPlainObject(i)&&s.isInteger(i.pick)&&(i=o.normalize(e,i.pick,r)),i},i.prototype.validate=function(e,t,i){var a=this,n=i&&i.interval?i.interval:a.item.interval;return a.disabled(t)&&(t=a.shift(t,n)),t=a.scope(t),a.disabled(t)&&(t=a.shift(t,-1*n)),t},i.prototype.disabled=function(e){var i=this,a=i.item.disable.filter(function(a){return s.isInteger(a)?e.hour==a:t.isArray(a)||s.isDate(a)?e.pick==i.create(a).pick:t.isPlainObject(a)?i.withinRange(a,e):void 0});return a=a.length&&!a.filter(function(e){return t.isArray(e)&&"inverted"==e[2]||t.isPlainObject(e)&&e.inverted}).length,-1===i.item.enable?!a:a||e.pick<i.item.min.pick||e.pick>i.item.max.pick},i.prototype.shift=function(e,t){var i=this,a=i.item.min.pick,n=i.item.max.pick;for(t=t||i.item.interval;i.disabled(e)&&(e=i.create(e.pick+=t),!(e.pick<=a||e.pick>=n)););return e},i.prototype.scope=function(e){var t=this.item.min.pick,i=this.item.max.pick;return this.create(e.pick>i?i:e.pick<t?t:e)},i.prototype.parse=function(e,t,i){var a,r,o,l,c,u=this,d={};if(!t||"string"!=typeof t)return t;i&&i.format||(i=i||{},i.format=u.settings.format),u.formats.toArray(i.format).map(function(e){var i,a=u.formats[e],n=a?s.trigger(a,u,[t,d]):e.replace(/^!/,"").length;a&&(i=t.substr(0,n),d[e]=i.match(/^\d+#x2F;)?+i:i),t=t.substr(n)});for(l in d)c=d[l],s.isInteger(c)?l.match(/^(h|hh)#x2F;i)?(a=c,("h"==l||"hh"==l)&&(a%=12)):"i"==l&&(r=c):l.match(/^a#x2F;i)&&c.match(/^p/i)&&("h"in d||"hh"in d)&&(o=!0);return(o?a+12:a)*n+r},i.prototype.formats={h:function(e,t){return e?s.digits(e):t.hour%r||r},hh:function(e,t){return e?2:s.lead(t.hour%r||r)},H:function(e,t){return e?s.digits(e):""+t.hour%24},HH:function(e,t){return e?s.digits(e):s.lead(t.hour%24)},i:function(e,t){return e?2:s.lead(t.mins)},a:function(e,t){return e?4:o/2>t.time%o?"a.m.":"p.m."},A:function(e,t){return e?2:o/2>t.time%o?"AM":"PM"},toArray:function(e){return e.split(/(h{1,2}|H{1,2}|i|a|A|!.)/g)},toString:function(e,t){var i=this;return i.formats.toArray(e).map(function(e){return s.trigger(i.formats[e],i,[0,t])||e.replace(/^!/,"")}).join("")}},i.prototype.isTimeExact=function(e,i){var a=this;return s.isInteger(e)&&s.isInteger(i)||"boolean"==typeof e&&"boolean"==typeof i?e===i:(s.isDate(e)||t.isArray(e))&&(s.isDate(i)||t.isArray(i))?a.create(e).pick===a.create(i).pick:t.isPlainObject(e)&&t.isPlainObject(i)?a.isTimeExact(e.from,i.from)&&a.isTimeExact(e.to,i.to):!1},i.prototype.isTimeOverlap=function(e,i){var a=this;return s.isInteger(e)&&(s.isDate(i)||t.isArray(i))?e===a.create(i).hour:s.isInteger(i)&&(s.isDate(e)||t.isArray(e))?i===a.create(e).hour:t.isPlainObject(e)&&t.isPlainObject(i)?a.overlapRanges(e,i):!1},i.prototype.flipEnable=function(e){var t=this.item;t.enable=e||(-1==t.enable?1:-1)},i.prototype.deactivate=function(e,i){var a=this,n=a.item.disable.slice(0);return"flip"==i?a.flipEnable():i===!1?(a.flipEnable(1),n=[]):i===!0?(a.flipEnable(-1),n=[]):i.map(function(e){for(var i,r=0;r<n.length;r+=1)if(a.isTimeExact(e,n[r])){i=!0;break}i||(s.isInteger(e)||s.isDate(e)||t.isArray(e)||t.isPlainObject(e)&&e.from&&e.to)&&n.push(e)}),n},i.prototype.activate=function(e,i){var a=this,n=a.item.disable,r=n.length;return"flip"==i?a.flipEnable():i===!0?(a.flipEnable(1),n=[]):i===!1?(a.flipEnable(-1),n=[]):i.map(function(e){var i,o,l,c;for(l=0;r>l;l+=1){if(o=n[l],a.isTimeExact(o,e)){i=n[l]=null,c=!0;break}if(a.isTimeOverlap(o,e)){t.isPlainObject(e)?(e.inverted=!0,i=e):t.isArray(e)?(i=e,i[2]||i.push("inverted")):s.isDate(e)&&(i=[e.getFullYear(),e.getMonth(),e.getDate(),"inverted"]);break}}if(i)for(l=0;r>l;l+=1)if(a.isTimeExact(n[l],e)){n[l]=null;break}if(c)for(l=0;r>l;l+=1)if(a.isTimeOverlap(n[l],e)){n[l]=null;break}i&&n.push(i)}),n.filter(function(e){return null!=e})},i.prototype.i=function(e,t){return s.isInteger(t)&&t>0?t:this.item.interval},i.prototype.nodes=function(e){var t=this,i=t.settings,a=t.item.select,n=t.item.highlight,r=t.item.view,o=t.item.disable;return s.node("ul",s.group({min:t.item.min.pick,max:t.item.max.pick,i:t.item.interval,node:"li",item:function(e){e=t.create(e);var l=e.pick,c=a&&a.pick==l,u=n&&n.pick==l,d=o&&t.disabled(e),h=s.trigger(t.formats.toString,t,[i.format,e]);return[s.trigger(t.formats.toString,t,[s.trigger(i.formatLabel,t,[e])||i.format,e]),function(e){return c&&e.push(i.klass.selected),u&&e.push(i.klass.highlighted),r&&r.pick==l&&e.push(i.klass.viewset),d&&e.push(i.klass.disabled),e.join(" ")}([i.klass.listItem]),"data-pick="+e.pick+" "+s.ariaAttr({role:"option",label:h,selected:c&&t.$node.val()===h?!0:null,activedescendant:u?!0:null,disabled:d?!0:null})]}})+s.node("li",s.node("button",i.clear,i.klass.buttonClear,"type=button data-clear=1"+(e?"":" disabled")+" "+s.ariaAttr({controls:t.$node[0].id})),"",s.ariaAttr({role:"presentation"})),i.klass.list,s.ariaAttr({role:"listbox",controls:t.$node[0].id}))},i.defaults=function(e){return{clear:"Clear",format:"h:i A",interval:30,closeOnSelect:!0,closeOnClear:!0,klass:{picker:e+" "+e+"--time",holder:e+"__holder",list:e+"__list",listItem:e+"__list-item",disabled:e+"__list-item--disabled",selected:e+"__list-item--selected",highlighted:e+"__list-item--highlighted",viewset:e+"__list-item--viewset",now:e+"__list-item--now",buttonClear:e+"__button--clear"}}}(e.klasses().picker),e.extend("pickatime",i)}),[].map||(Array.prototype.map=function(e,t){for(var i=this,a=i.length,n=new Array(a),r=0;a>r;r++)r in i&&(n[r]=e.call(t,i[r],r,i));return n}),[].filter||(Array.prototype.filter=function(e){if(null==this)throw new TypeError;var t=Object(this),i=t.length>>>0;if("function"!=typeof e)throw new TypeError;for(var a=[],n=arguments[1],r=0;i>r;r++)if(r in t){var o=t[r];e.call(n,o,r,t)&&a.push(o)}return a}),[].indexOf||(Array.prototype.indexOf=function(e){if(null==this)throw new TypeError;var t=Object(this),i=t.length>>>0;if(0===i)return-1;var a=0;if(arguments.length>1&&(a=Number(arguments[1]),a!=a?a=0:0!==a&&a!=1/0&&a!=-(1/0)&&(a=(a>0||-1)*Math.floor(Math.abs(a)))),a>=i)return-1;for(var n=a>=0?a:Math.max(i-Math.abs(a),0);i>n;n++)if(n in t&&t[n]===e)return n;return-1});var nativeSplit=String.prototype.split,compliantExecNpcg=void 0===/()??/.exec("")[1];String.prototype.split=function(e,t){var i=this;if("[object RegExp]"!==Object.prototype.toString.call(e))return nativeSplit.call(i,e,t);var a,n,r,o,s=[],l=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":""),c=0;for(e=new RegExp(e.source,l+"g"),i+="",compliantExecNpcg||(a=new RegExp("^"+e.source+"$(?!\\s)",l)),t=void 0===t?-1>>>0:t>>>0;(n=e.exec(i))&&(r=n.index+n[0].length,!(r>c&&(s.push(i.slice(c,n.index)),!compliantExecNpcg&&n.length>1&&n[0].replace(a,function(){for(var e=1;e<arguments.length-2;e++)void 0===arguments[e]&&(n[e]=void 0)}),n.length>1&&n.index<i.length&&Array.prototype.push.apply(s,n.slice(1)),o=n[0].length,c=r,s.length>=t)));)e.lastIndex===n.index&&e.lastIndex++;return c===i.length?(o||!e.test(""))&&s.push(""):s.push(i.slice(c)),s.length>t?s.slice(0,t):s},function(e){"use strict";var t={init:function(i){return this.each(function(){this.self=e(this),t.destroy.call(this.self),this.opt=e.extend(!0,{},e.fn.raty.defaults,i),t._adjustCallback.call(this),t._adjustNumber.call(this),"img"!==this.opt.starType&&t._adjustStarType.call(this),t._adjustPath.call(this),t._createStars.call(this),this.opt.cancel&&t._createCancel.call(this),this.opt.precision&&t._adjustPrecision.call(this),t._createScore.call(this),t._apply.call(this,this.opt.score),t._target.call(this,this.opt.score),this.opt.readOnly?t._lock.call(this):(this.style.cursor="pointer",t._binds.call(this)),this.self.data("options",this.opt)})},_adjustCallback:function(){for(var e=["number","readOnly","score","scoreName","target"],t=0;t<e.length;t++)"function"==typeof this.opt[e[t]]&&(this.opt[e[t]]=this.opt[e[t]].call(this))},_adjustNumber:function(){this.opt.number=t._between(this.opt.number,1,this.opt.numberMax)},_adjustPath:function(){this.opt.path=this.opt.path||"",this.opt.path&&"/"!==this.opt.path.charAt(this.opt.path.length-1)&&(this.opt.path+="/")},_adjustPrecision:function(){this.opt.half=!0,this.opt.targetType="score"},_adjustStarType:function(){this.opt.path="";for(var e=["cancelOff","cancelOn","starHalf","starOff","starOn"],t=0;t<e.length;t++)this.opt[e[t]]=this.opt[e[t]].replace(".","-")},_apply:function(e){t._fill.call(this,e),e&&(e>0&&this.score.val(t._between(e,0,this.opt.number)),t._roundStars.call(this,e))},_between:function(e,t,i){return Math.min(Math.max(parseFloat(e),t),i)},_binds:function(){this.cancel&&(t._bindOverCancel.call(this),t._bindClickCancel.call(this),t._bindOutCancel.call(this)),t._bindOver.call(this),t._bindClick.call(this),t._bindOut.call(this)},_bindClick:function(){var t=this;t.stars.on("click.raty",function(i){var a=e(this);t.score.val(t.opt.half||t.opt.precision?t.self.data("score"):this.alt||a.data("alt")),t.opt.click&&t.opt.click.call(t,+t.score.val(),i)})},_bindClickCancel:function(){var e=this;e.cancel.on("click.raty",function(t){e.score.removeAttr("value"),e.opt.click&&e.opt.click.call(e,null,t)})},_bindOut:function(){var e=this;e.self.on("mouseleave.raty",function(i){var a=+e.score.val()||void 0;t._apply.call(e,a),t._target.call(e,a,i),e.opt.mouseout&&e.opt.mouseout.call(e,a,i)})},_bindOutCancel:function(){var e=this;e.cancel.on("mouseleave.raty",function(i){var a=e.opt.cancelOff;if("img"!==e.opt.starType&&(a=e.opt.cancelClass+" "+a),t._setIcon.call(e,this,a),e.opt.mouseout){var n=+e.score.val()||void 0;e.opt.mouseout.call(e,n,i)}})},_bindOver:function(){var e=this,i=e.opt.half?"mousemove.raty":"mouseover.raty";e.stars.on(i,function(i){var a=t._getScoreByPosition.call(e,i,this);t._fill.call(e,a),e.opt.half&&(t._roundStars.call(e,a),e.self.data("score",a)),t._target.call(e,a,i),e.opt.mouseover&&e.opt.mouseover.call(e,a,i)})},_bindOverCancel:function(){var e=this;e.cancel.on("mouseover.raty",function(i){var a=e.opt.path+e.opt.starOff,n=e.opt.cancelOn;"img"===e.opt.starType?e.stars.attr("src",a):(n=e.opt.cancelClass+" "+n,e.stars.attr("class",a)),t._setIcon.call(e,this,n),t._target.call(e,null,i),e.opt.mouseover&&e.opt.mouseover.call(e,null)})},_buildScoreField:function(){return e("<input />",{name:this.opt.scoreName,type:"hidden"}).appendTo(this)},_createCancel:function(){var t=this.opt.path+this.opt.cancelOff,i=e("<"+this.opt.starType+" />",{title:this.opt.cancelHint,"class":this.opt.cancelClass});"img"===this.opt.starType?i.attr({src:t,alt:"x"}):i.attr("data-alt","x").addClass(t),"left"===this.opt.cancelPlace?this.self.prepend("&#160;").prepend(i):this.self.append("&#160;").append(i),this.cancel=i},_createScore:function(){var i=e(this.opt.targetScore);this.score=i.length?i:t._buildScoreField.call(this)},_createStars:function(){for(var i=1;i<=this.opt.number;i++){var a=t._nameForIndex.call(this,i),n={alt:i,src:this.opt.path+this.opt[a]};"img"!==this.opt.starType&&(n={"data-alt":i,"class":n.src}),n.title=t._getHint.call(this,i),e("<"+this.opt.starType+" />",n).appendTo(this),this.opt.space&&this.self.append(i<this.opt.number?"&#160;":"")}this.stars=this.self.children(this.opt.starType)},_error:function(t){e(this).text(t),e.error(t)},_fill:function(e){for(var i=0,a=1;a<=this.stars.length;a++){var n,r=this.stars[a-1],o=t._turnOn.call(this,a,e);if(this.opt.iconRange&&this.opt.iconRange.length>i){var s=this.opt.iconRange[i];n=t._getRangeIcon.call(this,s,o),a<=s.range&&t._setIcon.call(this,r,n),a===s.range&&i++}else n=this.opt[o?"starOn":"starOff"],t._setIcon.call(this,r,n)}},_getRangeIcon:function(e,t){return t?e.on||this.opt.starOn:e.off||this.opt.starOff},_getScoreByPosition:function(i,a){var n=parseInt(a.alt||a.getAttribute("data-alt"),10);if(this.opt.half){var r=t._getSize.call(this),o=parseFloat((i.pageX-e(a).offset().left)/r);n=this.opt.precision?n-1+o:n-1+(o>.5?1:.5)}return n},_getSize:function(){var e;return e="img"===this.opt.starType?this.stars[0].width:parseFloat(this.stars.eq(0).css("font-size")),e||t._error.call(this,"Could not be possible get the icon size!"),e},_turnOn:function(e,t){return this.opt.single?e===t:t>=e},_getHint:function(e){var t=this.opt.hints[e-1];return""===t?"":t||e},_lock:function(){var e=parseInt(this.score.val(),10),i=e?t._getHint.call(this,e):this.opt.noRatedMsg;this.style.cursor="",this.title=i,this.score.prop("readonly",!0),this.stars.prop("title",i),this.cancel&&this.cancel.hide(),this.self.data("readonly",!0)},_nameForIndex:function(e){return this.opt.score&&this.opt.score>=e?"starOn":"starOff"},_roundStars:function(e){var i=(e%1).toFixed(2);if(i>this.opt.round.down){var a="starOn";this.opt.halfShow&&i<this.opt.round.up?a="starHalf":i<this.opt.round.full&&(a="starOff");var n=this.opt[a],r=this.stars[Math.ceil(e)-1];t._setIcon.call(this,r,n)}},_setIcon:function(e,t){e["img"===this.opt.starType?"src":"className"]=this.opt.path+t},_setTarget:function(e,t){t&&(t=this.opt.targetFormat.toString().replace("{score}",t)),e.is(":input")?e.val(t):e.html(t)},_target:function(i,a){if(this.opt.target){var n=e(this.opt.target);n.length||t._error.call(this,"Target selector invalid or missing!");var r=a&&"mouseover"===a.type;if(void 0===i)i=this.opt.targetText;else if(null===i)i=r?this.opt.cancelHint:this.opt.targetText;else{"hint"===this.opt.targetType?i=t._getHint.call(this,Math.ceil(i)):this.opt.precision&&(i=parseFloat(i).toFixed(1));var o=a&&"mousemove"===a.type;r||o||this.opt.targetKeep||(i=this.opt.targetText)}t._setTarget.call(this,n,i)}},_unlock:function(){this.style.cursor="pointer",this.removeAttribute("title"),this.score.removeAttr("readonly"),this.self.data("readonly",!1);for(var e=0;e<this.opt.number;e++)this.stars[e].title=t._getHint.call(this,e+1);this.cancel&&this.cancel.css("display","")},cancel:function(i){return this.each(function(){var a=e(this);a.data("readonly")!==!0&&(t[i?"click":"score"].call(a,null),this.score.removeAttr("value"))})},click:function(i){return this.each(function(){e(this).data("readonly")!==!0&&(t._apply.call(this,i),this.opt.click&&this.opt.click.call(this,i,e.Event("click")),t._target.call(this,i))})},destroy:function(){return this.each(function(){var t=e(this),i=t.data("raw");i?t.off(".raty").empty().css({cursor:i.style.cursor}).removeData("readonly"):t.data("raw",t.clone()[0])})},getScore:function(){var e,t=[];return this.each(function(){e=this.score.val(),t.push(e?+e:void 0)}),t.length>1?t:t[0]},move:function(i){return this.each(function(){var a=parseInt(i,10),n=e(this).data("options"),r=(+i).toFixed(1).split(".")[1];a>=n.number&&(a=n.number-1,r=10);var o=t._getSize.call(this),s=o/10,l=e(this.stars[a]),c=l.offset().left+s*parseInt(r,10),u=e.Event("mousemove",{pageX:c});l.trigger(u)})},readOnly:function(i){return this.each(function(){var a=e(this);a.data("readonly")!==i&&(i?(a.off(".raty").children("img").off(".raty"),t._lock.call(this)):(t._binds.call(this),t._unlock.call(this)),a.data("readonly",i))})},reload:function(){return t.set.call(this,{})},score:function(){var i=e(this);return arguments.length?t.setScore.apply(i,arguments):t.getScore.call(i)},set:function(t){return this.each(function(){var i=e(this),a=i.data("options"),n=e.extend({},a,t);i.raty(n)})},setScore:function(i){return this.each(function(){e(this).data("readonly")!==!0&&(t._apply.call(this,i),t._target.call(this,i))})}};e.fn.raty=function(i){return t[i]?t[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void e.error("Method "+i+" does not exist!"):t.init.apply(this,arguments)},e.fn.raty.defaults={cancel:!1,cancelClass:"raty-cancel",cancelHint:"Cancel this rating!",cancelOff:"cancel-off.png",cancelOn:"cancel-on.png",cancelPlace:"left",click:void 0,half:!1,halfShow:!0,hints:["bad","poor","regular","good","gorgeous"],iconRange:void 0,mouseout:void 0,mouseover:void 0,noRatedMsg:"Not rated yet!",number:5,numberMax:20,path:void 0,precision:!1,readOnly:!1,round:{down:.25,full:.6,up:.76},score:void 0,scoreName:"score",single:!1,space:!0,starHalf:"star-half.png",starOff:"star-off.png",starOn:"star-on.png",starType:"img",target:void 0,targetFormat:"{score}",targetKeep:!1,targetScore:void 0,targetText:"",targetType:"hint"}}(jQuery),function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";function t(t){return!t.nodeName||-1!==e.inArray(t.nodeName.toLowerCase(),["iframe","#document","html","body"])}function i(t){return e.isFunction(t)||e.isPlainObject(t)?t:{top:t,left:t}}var a=e.scrollTo=function(t,i,a){return e(window).scrollTo(t,i,a)};return a.defaults={axis:"xy",duration:0,limit:!0},e.fn.scrollTo=function(n,r,o){"object"==typeof r&&(o=r,r=0),"function"==typeof o&&(o={onAfter:o}),"max"===n&&(n=9e9),o=e.extend({},a.defaults,o),r=r||o.duration;var s=o.queue&&o.axis.length>1;return s&&(r/=2),o.offset=i(o.offset),o.over=i(o.over),this.each(function(){function l(t){var i=e.extend({},o,{queue:!0,duration:r,complete:t&&function(){t.call(d,p,o)}});h.animate(f,i)}if(null!==n){var c,u=t(this),d=u?this.contentWindow||window:this,h=e(d),p=n,f={};switch(typeof p){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?#x2F;.test(p)){p=i(p);break}if(p=u?e(p):e(p,d),!p.length)return;case"object":(p.is||p.style)&&(c=(p=e(p)).offset())}var m=e.isFunction(o.offset)&&o.offset(d,p)||o.offset;e.each(o.axis.split(""),function(e,t){var i="x"===t?"Left":"Top",n=i.toLowerCase(),r="scroll"+i,g=h[r](),v=a.max(d,t);if(c)f[r]=c[n]+(u?0:g-h.offset()[n]),o.margin&&(f[r]-=parseInt(p.css("margin"+i),10)||0,f[r]-=parseInt(p.css("border"+i+"Width"),10)||0),f[r]+=m[n]||0,o.over[n]&&(f[r]+=p["x"===t?"width":"height"]()*o.over[n]);else{var y=p[n];f[r]=y.slice&&"%"===y.slice(-1)?parseFloat(y)/100*v:y}o.limit&&/^\d+#x2F;.test(f[r])&&(f[r]=f[r]<=0?0:Math.min(f[r],v)),!e&&o.axis.length>1&&(g===f[r]?f={}:s&&(l(o.onAfterFirst),f={}))}),l(o.onAfter)}})},a.max=function(i,a){var n="x"===a?"Width":"Height",r="scroll"+n;if(!t(i))return i[r]-e(i)[n.toLowerCase()]();var o="client"+n,s=i.ownerDocument||i.document,l=s.documentElement,c=s.body;return Math.max(l[r],c[r])-Math.min(l[o],c[o])},e.Tween.propHooks.scrollLeft=e.Tween.propHooks.scrollTop={get:function(t){return e(t.elem)[t.prop]()},set:function(t){var i=this.get(t);if(t.options.interrupt&&t._last&&t._last!==i)return e(t.elem).stop();var a=Math.round(t.now);i!==a&&(e(t.elem)[t.prop](a),t._last=this.get(t))}},a}),!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var o=t||window.event,s=l.call(arguments,1),c=0,d=0,h=0,p=0,f=0,m=0;if(t=e.event.fix(o),t.type="mousewheel","detail"in o&&(h=-1*o.detail),"wheelDelta"in o&&(h=o.wheelDelta),"wheelDeltaY"in o&&(h=o.wheelDeltaY),"wheelDeltaX"in o&&(d=-1*o.wheelDeltaX),"axis"in o&&o.axis===o.HORIZONTAL_AXIS&&(d=-1*h,h=0),c=0===h?d:h,"deltaY"in o&&(h=-1*o.deltaY,c=h),"deltaX"in o&&(d=o.deltaX,0===h&&(c=-1*d)),0!==h||0!==d){if(1===o.deltaMode){var g=e.data(this,"mousewheel-line-height");c*=g,h*=g,d*=g}else if(2===o.deltaMode){var v=e.data(this,"mousewheel-page-height");c*=v,h*=v,d*=v}if(p=Math.max(Math.abs(h),Math.abs(d)),(!r||r>p)&&(r=p,a(o,p)&&(r/=40)),a(o,p)&&(c/=40,d/=40,h/=40),c=Math[c>=1?"floor":"ceil"](c/r),d=Math[d>=1?"floor":"ceil"](d/r),h=Math[h>=1?"floor":"ceil"](h/r),u.settings.normalizeOffset&&this.getBoundingClientRect){var y=this.getBoundingClientRect();f=t.clientX-y.left,m=t.clientY-y.top}return t.deltaX=d,t.deltaY=h,t.deltaFactor=r,t.offsetX=f,t.offsetY=m,t.deltaMode=0,s.unshift(t,c,d,h),n&&clearTimeout(n),n=setTimeout(i,200),(e.event.dispatch||e.event.handle).apply(this,s)}}function i(){r=null}function a(e,t){return u.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120===0}var n,r,o=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],s="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],l=Array.prototype.slice;if(e.event.fixHooks)for(var c=o.length;c;)e.event.fixHooks[o[--c]]=e.event.mouseHooks;var u=e.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var i=s.length;i;)this.addEventListener(s[--i],t,!1);else this.onmousewheel=t;e.data(this,"mousewheel-line-height",u.getLineHeight(this)),e.data(this,"mousewheel-page-height",u.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var i=s.length;i;)this.removeEventListener(s[--i],t,!1);else this.onmousewheel=null;e.removeData(this,"mousewheel-line-height"),e.removeData(this,"mousewheel-page-height")},getLineHeight:function(t){var i=e(t),a=i["offsetParent"in e.fn?"offsetParent":"parent"]();return a.length||(a=e("body")),parseInt(a.css("fontSize"),10)||parseInt(i.css("fontSize"),10)||16},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),!function(e){"undefined"!=typeof module&&module.exports?module.exports=e:e(jQuery,window,document)}(function(e){!function(t){var i="function"==typeof define&&define.amd,a="undefined"!=typeof module&&module.exports,n="https:"==document.location.protocol?"https:":"http:",r="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.12/jquery.mousewheel.min.js";i||(a?require("jquery-mousewheel")(e):e.event.special.mousewheel||e("head").append(decodeURI("%3Cscript src="+n+"//"+r+"%3E%3C/script%3E"))),t()}(function(){var t,i="mCustomScrollbar",a="mCS",n=".mCustomScrollbar",r={setTop:0,setLeft:0,axis:"y",scrollbarPosition:"inside",scrollInertia:950,autoDraggerLength:!0,alwaysShowScrollbar:0,snapOffset:0,mouseWheel:{enable:!0,scrollAmount:"auto",axis:"y",deltaFactor:"auto",disableOver:["select","option","keygen","datalist","textarea"]},scrollButtons:{scrollType:"stepless",scrollAmount:"auto"},keyboard:{enable:!0,scrollType:"stepless",scrollAmount:"auto"},contentTouchScroll:25,advanced:{autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",updateOnContentResize:!0,updateOnImageLoad:!0},theme:"light",callbacks:{onTotalScrollOffset:0,onTotalScrollBackOffset:0,alwaysTriggerOffsets:!0}},o=0,s={},l=window.attachEvent&&!window.addEventListener?1:0,c=!1,u=["mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar","mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer","mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft","mCSB_buttonRight"],d={init:function(t){var t=e.extend(!0,{},r,t),i=h.call(this);if(t.live){var l=t.liveSelector||this.selector||n,c=e(l);if("off"===t.live)return void f(l);s[l]=setTimeout(function(){c.mCustomScrollbar(t),"once"===t.live&&c.length&&f(l)},500)}else f(l);return t.setWidth=t.set_width?t.set_width:t.setWidth,t.setHeight=t.set_height?t.set_height:t.setHeight,t.axis=t.horizontalScroll?"x":m(t.axis),t.scrollInertia=t.scrollInertia>0&&t.scrollInertia<17?17:t.scrollInertia,"object"!=typeof t.mouseWheel&&1==t.mouseWheel&&(t.mouseWheel={enable:!0,scrollAmount:"auto",axis:"y",preventDefault:!1,deltaFactor:"auto",normalizeDelta:!1,invert:!1}),t.mouseWheel.scrollAmount=t.mouseWheelPixels?t.mouseWheelPixels:t.mouseWheel.scrollAmount,t.mouseWheel.normalizeDelta=t.advanced.normalizeMouseWheelDelta?t.advanced.normalizeMouseWheelDelta:t.mouseWheel.normalizeDelta,t.scrollButtons.scrollType=g(t.scrollButtons.scrollType),p(t),e(i).each(function(){var i=e(this);if(!i.data(a)){i.data(a,{idx:++o,opt:t,scrollRatio:{y:null,x:null},overflowed:null,contentReset:{y:null,x:null},bindEvents:!1,tweenRunning:!1,sequential:{},langDir:i.css("direction"),cbOffsets:null,trigger:null});var n=i.data(a),r=n.opt,s=i.data("mcs-axis"),l=i.data("mcs-scrollbar-position"),c=i.data("mcs-theme");s&&(r.axis=s),l&&(r.scrollbarPosition=l),c&&(r.theme=c,p(r)),v.call(this),e("#mCSB_"+n.idx+"_container img:not(."+u[2]+")").addClass(u[2]),d.update.call(null,i)}})},update:function(t,i){var n=t||h.call(this);return e(n).each(function(){var t=e(this);if(t.data(a)){var n=t.data(a),r=n.opt,o=e("#mCSB_"+n.idx+"_container"),s=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];if(!o.length)return;n.tweenRunning&&Y(t),t.hasClass(u[3])&&t.removeClass(u[3]),t.hasClass(u[4])&&t.removeClass(u[4]),x.call(this),b.call(this),"y"===r.axis||r.advanced.autoExpandHorizontalScroll||o.css("width",y(o.children())),n.overflowed=j.call(this),D.call(this),r.autoDraggerLength&&_.call(this),C.call(this),Q.call(this);var l=[Math.abs(o[0].offsetTop),Math.abs(o[0].offsetLeft)];"x"!==r.axis&&(n.overflowed[0]?s[0].height()>s[0].parent().height()?k.call(this):(X(t,l[0].toString(),{dir:"y",dur:0,overwrite:"none"}),n.contentReset.y=null):(k.call(this),"y"===r.axis?T.call(this):"yx"===r.axis&&n.overflowed[1]&&X(t,l[1].toString(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==r.axis&&(n.overflowed[1]?s[1].width()>s[1].parent().width()?k.call(this):(X(t,l[1].toString(),{dir:"x",dur:0,overwrite:"none"}),n.contentReset.x=null):(k.call(this),"x"===r.axis?T.call(this):"yx"===r.axis&&n.overflowed[0]&&X(t,l[0].toString(),{dir:"y",dur:0,overwrite:"none"}))),i&&n&&(2===i&&r.callbacks.onImageLoad&&"function"==typeof r.callbacks.onImageLoad?r.callbacks.onImageLoad.call(this):3===i&&r.callbacks.onSelectorChange&&"function"==typeof r.callbacks.onSelectorChange?r.callbacks.onSelectorChange.call(this):r.callbacks.onUpdate&&"function"==typeof r.callbacks.onUpdate&&r.callbacks.onUpdate.call(this)),U.call(this)}})},scrollTo:function(t,i){if("undefined"!=typeof t&&null!=t){var n=h.call(this);return e(n).each(function(){var n=e(this);if(n.data(a)){var r=n.data(a),o=r.opt,s={trigger:"external",scrollInertia:o.scrollInertia,scrollEasing:"mcsEaseInOut",moveDragger:!1,timeout:60,callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},l=e.extend(!0,{},s,i),c=z.call(this,t),u=l.scrollInertia>0&&l.scrollInertia<17?17:l.scrollInertia;c[0]=N.call(this,c[0],"y"),c[1]=N.call(this,c[1],"x"),l.moveDragger&&(c[0]*=r.scrollRatio.y,c[1]*=r.scrollRatio.x),l.dur=u,setTimeout(function(){null!==c[0]&&"undefined"!=typeof c[0]&&"x"!==o.axis&&r.overflowed[0]&&(l.dir="y",l.overwrite="all",X(n,c[0].toString(),l)),null!==c[1]&&"undefined"!=typeof c[1]&&"y"!==o.axis&&r.overflowed[1]&&(l.dir="x",l.overwrite="none",X(n,c[1].toString(),l))},l.timeout)}})}},stop:function(){var t=h.call(this);return e(t).each(function(){var t=e(this);t.data(a)&&Y(t)})},disable:function(t){var i=h.call(this);return e(i).each(function(){var i=e(this);i.data(a)&&(i.data(a),U.call(this,"remove"),T.call(this),t&&k.call(this),D.call(this,!0),i.addClass(u[3]))})},destroy:function(){var t=h.call(this);return e(t).each(function(){var n=e(this);if(n.data(a)){var r=n.data(a),o=r.opt,s=e("#mCSB_"+r.idx),l=e("#mCSB_"+r.idx+"_container"),c=e(".mCSB_"+r.idx+"_scrollbar");o.live&&f(o.liveSelector||e(t).selector),U.call(this,"remove"),T.call(this),k.call(this),n.removeData(a),Z(this,"mcs"),c.remove(),l.find("img."+u[2]).removeClass(u[2]),s.replaceWith(l.contents()),n.removeClass(i+" _"+a+"_"+r.idx+" "+u[6]+" "+u[7]+" "+u[5]+" "+u[3]).addClass(u[4])}})}},h=function(){return"object"!=typeof e(this)||e(this).length<1?n:this},p=function(t){var i=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"],a=["rounded-dots","rounded-dots-dark","3d","3d-dark","3d-thick","3d-thick-dark","inset","inset-dark","inset-2","inset-2-dark","inset-3","inset-3-dark"],n=["minimal","minimal-dark"],r=["minimal","minimal-dark"],o=["minimal","minimal-dark"];t.autoDraggerLength=e.inArray(t.theme,i)>-1?!1:t.autoDraggerLength,t.autoExpandScrollbar=e.inArray(t.theme,a)>-1?!1:t.autoExpandScrollbar,t.scrollButtons.enable=e.inArray(t.theme,n)>-1?!1:t.scrollButtons.enable,t.autoHideScrollbar=e.inArray(t.theme,r)>-1?!0:t.autoHideScrollbar,t.scrollbarPosition=e.inArray(t.theme,o)>-1?"outside":t.scrollbarPosition},f=function(e){s[e]&&(clearTimeout(s[e]),Z(s,e))},m=function(e){return"yx"===e||"xy"===e||"auto"===e?"yx":"x"===e||"horizontal"===e?"x":"y"},g=function(e){return"stepped"===e||"pixels"===e||"step"===e||"click"===e?"stepped":"stepless"},v=function(){var t=e(this),n=t.data(a),r=n.opt,o=r.autoExpandScrollbar?" "+u[1]+"_expand":"",s=["<div id='mCSB_"+n.idx+"_scrollbar_vertical' class='mCSB_scrollTools mCSB_"+n.idx+"_scrollbar mCS-"+r.theme+" mCSB_scrollTools_vertical"+o+"'><div class='"+u[12]+"'><div id='mCSB_"+n.idx+"_dragger_vertical' class='mCSB_dragger' style='position:absolute;' oncontextmenu='return false;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>","<div id='mCSB_"+n.idx+"_scrollbar_horizontal' class='mCSB_scrollTools mCSB_"+n.idx+"_scrollbar mCS-"+r.theme+" mCSB_scrollTools_horizontal"+o+"'><div class='"+u[12]+"'><div id='mCSB_"+n.idx+"_dragger_horizontal' class='mCSB_dragger' style='position:absolute;' oncontextmenu='return false;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>"],l="yx"===r.axis?"mCSB_vertical_horizontal":"x"===r.axis?"mCSB_horizontal":"mCSB_vertical",c="yx"===r.axis?s[0]+s[1]:"x"===r.axis?s[1]:s[0],d="yx"===r.axis?"<div id='mCSB_"+n.idx+"_container_wrapper' class='mCSB_container_wrapper' />":"",h=r.autoHideScrollbar?" "+u[6]:"",p="x"!==r.axis&&"rtl"===n.langDir?" "+u[7]:"";r.setWidth&&t.css("width",r.setWidth),r.setHeight&&t.css("height",r.setHeight),r.setLeft="y"!==r.axis&&"rtl"===n.langDir?"989999px":r.setLeft,t.addClass(i+" _"+a+"_"+n.idx+h+p).wrapInner("<div id='mCSB_"+n.idx+"' class='mCustomScrollBox mCS-"+r.theme+" "+l+"'><div id='mCSB_"+n.idx+"_container' class='mCSB_container' style='position:relative; top:"+r.setTop+"; left:"+r.setLeft+";' dir="+n.langDir+" /></div>");
6
var f=e("#mCSB_"+n.idx),m=e("#mCSB_"+n.idx+"_container");"y"===r.axis||r.advanced.autoExpandHorizontalScroll||m.css("width",y(m.children())),"outside"===r.scrollbarPosition?("static"===t.css("position")&&t.css("position","relative"),t.css("overflow","visible"),f.addClass("mCSB_outside").after(c)):(f.addClass("mCSB_inside").append(c),m.wrap(d)),w.call(this);var g=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")];g[0].css("min-height",g[0].height()),g[1].css("min-width",g[1].width())},y=function(t){return Math.max.apply(Math,t.map(function(){return e(this).outerWidth(!0)}).get())},b=function(){var t=e(this),i=t.data(a),n=i.opt,r=e("#mCSB_"+i.idx+"_container");n.advanced.autoExpandHorizontalScroll&&"y"!==n.axis&&r.css({position:"absolute",width:"auto"}).wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />").css({width:Math.ceil(r[0].getBoundingClientRect().right+.4)-Math.floor(r[0].getBoundingClientRect().left),position:"relative"}).unwrap()},w=function(){var t=e(this),i=t.data(a),n=i.opt,r=e(".mCSB_"+i.idx+"_scrollbar:first"),o=te(n.scrollButtons.tabindex)?"tabindex='"+n.scrollButtons.tabindex+"'":"",s=["<a href='#' class='"+u[13]+"' oncontextmenu='return false;' "+o+" />","<a href='#' class='"+u[14]+"' oncontextmenu='return false;' "+o+" />","<a href='#' class='"+u[15]+"' oncontextmenu='return false;' "+o+" />","<a href='#' class='"+u[16]+"' oncontextmenu='return false;' "+o+" />"],l=["x"===n.axis?s[2]:s[0],"x"===n.axis?s[3]:s[1],s[2],s[3]];n.scrollButtons.enable&&r.prepend(l[0]).append(l[1]).next(".mCSB_scrollTools").prepend(l[2]).append(l[3])},x=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=t.css("max-height")||"none",o=-1!==r.indexOf("%"),s=t.css("box-sizing");if("none"!==r){var l=o?t.parent().height()*parseInt(r)/100:parseInt(r);"border-box"===s&&(l-=t.innerHeight()-t.height()+(t.outerHeight()-t.innerHeight())),n.css("max-height",Math.round(l))}},_=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=e("#mCSB_"+i.idx+"_container"),o=[e("#mCSB_"+i.idx+"_dragger_vertical"),e("#mCSB_"+i.idx+"_dragger_horizontal")],s=[n.height()/r.outerHeight(!1),n.width()/r.outerWidth(!1)],c=[parseInt(o[0].css("min-height")),Math.round(s[0]*o[0].parent().height()),parseInt(o[1].css("min-width")),Math.round(s[1]*o[1].parent().width())],u=l&&c[1]<c[0]?c[0]:c[1],d=l&&c[3]<c[2]?c[2]:c[3];o[0].css({height:u,"max-height":o[0].parent().height()-10}).find(".mCSB_dragger_bar").css({"line-height":c[0]+"px"}),o[1].css({width:d,"max-width":o[1].parent().width()-10})},C=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=e("#mCSB_"+i.idx+"_container"),o=[e("#mCSB_"+i.idx+"_dragger_vertical"),e("#mCSB_"+i.idx+"_dragger_horizontal")],s=[r.outerHeight(!1)-n.height(),r.outerWidth(!1)-n.width()],l=[s[0]/(o[0].parent().height()-o[0].height()),s[1]/(o[1].parent().width()-o[1].width())];i.scrollRatio={y:l[0],x:l[1]}},S=function(e,t,i){var a=i?u[0]+"_expanded":"",n=e.closest(".mCSB_scrollTools");"active"===t?(e.toggleClass(u[0]+" "+a),n.toggleClass(u[1]),e[0]._draggable=e[0]._draggable?0:1):e[0]._draggable||("hide"===t?(e.removeClass(u[0]),n.removeClass(u[1])):(e.addClass(u[0]),n.addClass(u[1])))},j=function(){var t=e(this),i=t.data(a),n=e("#mCSB_"+i.idx),r=e("#mCSB_"+i.idx+"_container"),o=null==i.overflowed?r.height():r.outerHeight(!1),s=null==i.overflowed?r.width():r.outerWidth(!1);return[o>n.height(),s>n.width()]},k=function(){var t=e(this),i=t.data(a),n=i.opt,r=e("#mCSB_"+i.idx),o=e("#mCSB_"+i.idx+"_container"),s=[e("#mCSB_"+i.idx+"_dragger_vertical"),e("#mCSB_"+i.idx+"_dragger_horizontal")];if(Y(t),("x"!==n.axis&&!i.overflowed[0]||"y"===n.axis&&i.overflowed[0])&&(s[0].add(o).css("top",0),X(t,"_resetY")),"y"!==n.axis&&!i.overflowed[1]||"x"===n.axis&&i.overflowed[1]){var l=dx=0;"rtl"===i.langDir&&(l=r.width()-o.outerWidth(!1),dx=Math.abs(l/i.scrollRatio.x)),o.css("left",l),s[1].css("left",dx),X(t,"_resetX")}},Q=function(){function t(){o=setTimeout(function(){e.event.special.mousewheel?(clearTimeout(o),A.call(i[0])):t()},100)}var i=e(this),n=i.data(a),r=n.opt;if(!n.bindEvents){if(E.call(this),r.contentTouchScroll&&M.call(this),I.call(this),r.mouseWheel.enable){var o;t()}H.call(this),L.call(this),r.advanced.autoScrollOnFocus&&F.call(this),r.scrollButtons.enable&&B.call(this),r.keyboard.enable&&W.call(this),n.bindEvents=!0}},T=function(){var t=e(this),i=t.data(a),n=i.opt,r=a+"_"+i.idx,o=".mCSB_"+i.idx+"_scrollbar",s=e("#mCSB_"+i.idx+",#mCSB_"+i.idx+"_container,#mCSB_"+i.idx+"_container_wrapper,"+o+" ."+u[12]+",#mCSB_"+i.idx+"_dragger_vertical,#mCSB_"+i.idx+"_dragger_horizontal,"+o+">a"),l=e("#mCSB_"+i.idx+"_container");n.advanced.releaseDraggableSelectors&&s.add(e(n.advanced.releaseDraggableSelectors)),i.bindEvents&&(e(document).unbind("."+r),s.each(function(){e(this).unbind("."+r)}),clearTimeout(t[0]._focusTimeout),Z(t[0],"_focusTimeout"),clearTimeout(i.sequential.step),Z(i.sequential,"step"),clearTimeout(l[0].onCompleteTimeout),Z(l[0],"onCompleteTimeout"),i.bindEvents=!1)},D=function(t){var i=e(this),n=i.data(a),r=n.opt,o=e("#mCSB_"+n.idx+"_container_wrapper"),s=o.length?o:e("#mCSB_"+n.idx+"_container"),l=[e("#mCSB_"+n.idx+"_scrollbar_vertical"),e("#mCSB_"+n.idx+"_scrollbar_horizontal")],c=[l[0].find(".mCSB_dragger"),l[1].find(".mCSB_dragger")];"x"!==r.axis&&(n.overflowed[0]&&!t?(l[0].add(c[0]).add(l[0].children("a")).css("display","block"),s.removeClass(u[8]+" "+u[10])):(r.alwaysShowScrollbar?(2!==r.alwaysShowScrollbar&&c[0].css("display","none"),s.removeClass(u[10])):(l[0].css("display","none"),s.addClass(u[10])),s.addClass(u[8]))),"y"!==r.axis&&(n.overflowed[1]&&!t?(l[1].add(c[1]).add(l[1].children("a")).css("display","block"),s.removeClass(u[9]+" "+u[11])):(r.alwaysShowScrollbar?(2!==r.alwaysShowScrollbar&&c[1].css("display","none"),s.removeClass(u[11])):(l[1].css("display","none"),s.addClass(u[11])),s.addClass(u[9]))),n.overflowed[0]||n.overflowed[1]?i.removeClass(u[5]):i.addClass(u[5])},O=function(e){var t=e.type;switch(t){case"pointerdown":case"MSPointerDown":case"pointermove":case"MSPointerMove":case"pointerup":case"MSPointerUp":return e.target.ownerDocument!==document?[e.originalEvent.screenY,e.originalEvent.screenX,!1]:[e.originalEvent.pageY,e.originalEvent.pageX,!1];case"touchstart":case"touchmove":case"touchend":var i=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],a=e.originalEvent.touches.length||e.originalEvent.changedTouches.length;return e.target.ownerDocument!==document?[i.screenY,i.screenX,a>1]:[i.pageY,i.pageX,a>1];default:return[e.pageY,e.pageX,!1]}},E=function(){function t(e){var t=f.find("iframe");if(t.length){var i=e?"auto":"none";t.css("pointer-events",i)}}function i(e,t,i,a){if(f[0].idleTimer=d.scrollInertia<233?250:0,n.attr("id")===p[1])var r="x",o=(n[0].offsetLeft-t+a)*u.scrollRatio.x;else var r="y",o=(n[0].offsetTop-e+i)*u.scrollRatio.y;X(s,o.toString(),{dir:r,drag:!0})}var n,r,o,s=e(this),u=s.data(a),d=u.opt,h=a+"_"+u.idx,p=["mCSB_"+u.idx+"_dragger_vertical","mCSB_"+u.idx+"_dragger_horizontal"],f=e("#mCSB_"+u.idx+"_container"),m=e("#"+p[0]+",#"+p[1]),g=d.advanced.releaseDraggableSelectors?m.add(e(d.advanced.releaseDraggableSelectors)):m;m.bind("mousedown."+h+" touchstart."+h+" pointerdown."+h+" MSPointerDown."+h,function(i){if(i.stopImmediatePropagation(),i.preventDefault(),J(i)){c=!0,l&&(document.onselectstart=function(){return!1}),t(!1),Y(s),n=e(this);var a=n.offset(),u=O(i)[0]-a.top,h=O(i)[1]-a.left,p=n.height()+a.top,f=n.width()+a.left;p>u&&u>0&&f>h&&h>0&&(r=u,o=h),S(n,"active",d.autoExpandScrollbar)}}).bind("touchmove."+h,function(e){e.stopImmediatePropagation(),e.preventDefault();var t=n.offset(),a=O(e)[0]-t.top,s=O(e)[1]-t.left;i(r,o,a,s)}),e(document).bind("mousemove."+h+" pointermove."+h+" MSPointerMove."+h,function(e){if(n){var t=n.offset(),a=O(e)[0]-t.top,s=O(e)[1]-t.left;if(r===a)return;i(r,o,a,s)}}).add(g).bind("mouseup."+h+" touchend."+h+" pointerup."+h+" MSPointerUp."+h,function(){n&&(S(n,"active",d.autoExpandScrollbar),n=null),c=!1,l&&(document.onselectstart=null),t(!0)})},M=function(){function i(e){if(!ee(e)||c||O(e)[2])return void(t=0);t=1,x=0,_=0;var i=T.offset();u=O(e)[0]-i.top,d=O(e)[1]-i.left,R=[O(e)[0],O(e)[1]]}function n(e){if(ee(e)&&!c&&!O(e)[2]&&(e.stopImmediatePropagation(),!_||x)){m=G();var t=Q.offset(),i=O(e)[0]-t.top,a=O(e)[1]-t.left,n="mcsLinearOut";if(E.push(i),M.push(a),R[2]=Math.abs(O(e)[0]-R[0]),R[3]=Math.abs(O(e)[1]-R[1]),S.overflowed[0])var r=D[0].parent().height()-D[0].height(),o=u-i>0&&i-u>-(r*S.scrollRatio.y)&&(2*R[3]<R[2]||"yx"===j.axis);if(S.overflowed[1])var s=D[1].parent().width()-D[1].width(),h=d-a>0&&a-d>-(s*S.scrollRatio.x)&&(2*R[2]<R[3]||"yx"===j.axis);o||h?(e.preventDefault(),x=1):_=1,b="yx"===j.axis?[u-i,d-a]:"x"===j.axis?[null,d-a]:[u-i,null],T[0].idleTimer=250,S.overflowed[0]&&l(b[0],I,n,"y","all",!0),S.overflowed[1]&&l(b[1],I,n,"x",A,!0)}}function r(e){if(!ee(e)||c||O(e)[2])return void(t=0);t=1,e.stopImmediatePropagation(),Y(C),f=G();var i=Q.offset();h=O(e)[0]-i.top,p=O(e)[1]-i.left,E=[],M=[]}function o(e){if(ee(e)&&!c&&!O(e)[2]){e.stopImmediatePropagation(),x=0,_=0,g=G();var t=Q.offset(),i=O(e)[0]-t.top,a=O(e)[1]-t.left;if(!(g-m>30)){y=1e3/(g-f);var n="mcsEaseOut",r=2.5>y,o=r?[E[E.length-2],M[M.length-2]]:[0,0];v=r?[i-o[0],a-o[1]]:[i-h,a-p];var u=[Math.abs(v[0]),Math.abs(v[1])];y=r?[Math.abs(v[0]/4),Math.abs(v[1]/4)]:[y,y];var d=[Math.abs(T[0].offsetTop)-v[0]*s(u[0]/y[0],y[0]),Math.abs(T[0].offsetLeft)-v[1]*s(u[1]/y[1],y[1])];b="yx"===j.axis?[d[0],d[1]]:"x"===j.axis?[null,d[1]]:[d[0],null],w=[4*u[0]+j.scrollInertia,4*u[1]+j.scrollInertia];var C=parseInt(j.contentTouchScroll)||0;b[0]=u[0]>C?b[0]:0,b[1]=u[1]>C?b[1]:0,S.overflowed[0]&&l(b[0],w[0],n,"y",A,!1),S.overflowed[1]&&l(b[1],w[1],n,"x",A,!1)}}}function s(e,t){var i=[1.5*t,2*t,t/1.5,t/2];return e>90?t>4?i[0]:i[3]:e>60?t>3?i[3]:i[2]:e>30?t>8?i[1]:t>6?i[0]:t>4?t:i[2]:t>8?t:i[3]}function l(e,t,i,a,n,r){e&&X(C,e.toString(),{dur:t,scrollEasing:i,dir:a,overwrite:n,drag:r})}var u,d,h,p,f,m,g,v,y,b,w,x,_,C=e(this),S=C.data(a),j=S.opt,k=a+"_"+S.idx,Q=e("#mCSB_"+S.idx),T=e("#mCSB_"+S.idx+"_container"),D=[e("#mCSB_"+S.idx+"_dragger_vertical"),e("#mCSB_"+S.idx+"_dragger_horizontal")],E=[],M=[],I=0,A="yx"===j.axis?"none":"all",R=[],H=T.find("iframe"),F=["touchstart."+k+" pointerdown."+k+" MSPointerDown."+k,"touchmove."+k+" pointermove."+k+" MSPointerMove."+k,"touchend."+k+" pointerup."+k+" MSPointerUp."+k];T.bind(F[0],function(e){i(e)}).bind(F[1],function(e){n(e)}),Q.bind(F[0],function(e){r(e)}).bind(F[2],function(e){o(e)}),H.length&&H.each(function(){e(this).load(function(){P(this)&&e(this.contentDocument||this.contentWindow.document).bind(F[0],function(e){i(e),r(e)}).bind(F[1],function(e){n(e)}).bind(F[2],function(e){o(e)})})})},I=function(){function i(){return window.getSelection?window.getSelection().toString():document.selection&&"Control"!=document.selection.type?document.selection.createRange().text:0}function n(e,t,i){u.type=i&&r?"stepped":"stepless",u.scrollAmount=10,$(o,e,t,"mcsLinearOut",i?60:null)}var r,o=e(this),s=o.data(a),l=s.opt,u=s.sequential,d=a+"_"+s.idx,h=e("#mCSB_"+s.idx+"_container"),p=h.parent();h.bind("mousedown."+d,function(){t||r||(r=1,c=!0)}).add(document).bind("mousemove."+d,function(e){if(!t&&r&&i()){var a=h.offset(),o=O(e)[0]-a.top+h[0].offsetTop,c=O(e)[1]-a.left+h[0].offsetLeft;o>0&&o<p.height()&&c>0&&c<p.width()?u.step&&n("off",null,"stepped"):("x"!==l.axis&&s.overflowed[0]&&(0>o?n("on",38):o>p.height()&&n("on",40)),"y"!==l.axis&&s.overflowed[1]&&(0>c?n("on",37):c>p.width()&&n("on",39)))}}).bind("mouseup."+d,function(){t||(r&&(r=0,n("off",null)),c=!1)})},A=function(){function t(t,a){if(Y(i),!R(i,t.target)){var o="auto"!==r.mouseWheel.deltaFactor?parseInt(r.mouseWheel.deltaFactor):l&&t.deltaFactor<100?100:t.deltaFactor||100;if("x"===r.axis||"x"===r.mouseWheel.axis)var u="x",d=[Math.round(o*n.scrollRatio.x),parseInt(r.mouseWheel.scrollAmount)],h="auto"!==r.mouseWheel.scrollAmount?d[1]:d[0]>=s.width()?.9*s.width():d[0],p=Math.abs(e("#mCSB_"+n.idx+"_container")[0].offsetLeft),f=c[1][0].offsetLeft,m=c[1].parent().width()-c[1].width(),g=t.deltaX||t.deltaY||a;else var u="y",d=[Math.round(o*n.scrollRatio.y),parseInt(r.mouseWheel.scrollAmount)],h="auto"!==r.mouseWheel.scrollAmount?d[1]:d[0]>=s.height()?.9*s.height():d[0],p=Math.abs(e("#mCSB_"+n.idx+"_container")[0].offsetTop),f=c[0][0].offsetTop,m=c[0].parent().height()-c[0].height(),g=t.deltaY||a;"y"===u&&!n.overflowed[0]||"x"===u&&!n.overflowed[1]||(r.mouseWheel.invert&&(g=-g),r.mouseWheel.normalizeDelta&&(g=0>g?-1:1),(g>0&&0!==f||0>g&&f!==m||r.mouseWheel.preventDefault)&&(t.stopImmediatePropagation(),t.preventDefault()),X(i,(p-g*h).toString(),{dir:u}))}}var i=e(this),n=i.data(a),r=n.opt,o=a+"_"+n.idx,s=e("#mCSB_"+n.idx),c=[e("#mCSB_"+n.idx+"_dragger_vertical"),e("#mCSB_"+n.idx+"_dragger_horizontal")],u=e("#mCSB_"+n.idx+"_container").find("iframe");n&&(u.length&&u.each(function(){e(this).load(function(){P(this)&&e(this.contentDocument||this.contentWindow.document).bind("mousewheel."+o,function(e,i){t(e,i)})})}),s.bind("mousewheel."+o,function(e,i){t(e,i)}))},P=function(e){var t=null;try{var i=e.contentDocument||e.contentWindow.document;t=i.body.innerHTML}catch(a){}return null!==t},R=function(t,i){var n=i.nodeName.toLowerCase(),r=t.data(a).opt.mouseWheel.disableOver,o=["select","textarea"];return e.inArray(n,r)>-1&&!(e.inArray(n,o)>-1&&!e(i).is(":focus"))},H=function(){var t=e(this),i=t.data(a),n=a+"_"+i.idx,r=e("#mCSB_"+i.idx+"_container"),o=r.parent(),s=e(".mCSB_"+i.idx+"_scrollbar ."+u[12]);s.bind("touchstart."+n+" pointerdown."+n+" MSPointerDown."+n,function(){c=!0}).bind("touchend."+n+" pointerup."+n+" MSPointerUp."+n,function(){c=!1}).bind("click."+n,function(a){if(e(a.target).hasClass(u[12])||e(a.target).hasClass("mCSB_draggerRail")){Y(t);var n=e(this),s=n.find(".mCSB_dragger");if(n.parent(".mCSB_scrollTools_horizontal").length>0){if(!i.overflowed[1])return;var l="x",c=a.pageX>s.offset().left?-1:1,d=Math.abs(r[0].offsetLeft)-.9*c*o.width()}else{if(!i.overflowed[0])return;var l="y",c=a.pageY>s.offset().top?-1:1,d=Math.abs(r[0].offsetTop)-.9*c*o.height()}X(t,d.toString(),{dir:l,scrollEasing:"mcsEaseInOut"})}})},F=function(){var t=e(this),i=t.data(a),n=i.opt,r=a+"_"+i.idx,o=e("#mCSB_"+i.idx+"_container"),s=o.parent();o.bind("focusin."+r,function(){var i=e(document.activeElement),a=o.find(".mCustomScrollBox").length,r=0;i.is(n.advanced.autoScrollOnFocus)&&(Y(t),clearTimeout(t[0]._focusTimeout),t[0]._focusTimer=a?(r+17)*a:0,t[0]._focusTimeout=setTimeout(function(){var e=[ie(i)[0],ie(i)[1]],a=[o[0].offsetTop,o[0].offsetLeft],l=[a[0]+e[0]>=0&&a[0]+e[0]<s.height()-i.outerHeight(!1),a[1]+e[1]>=0&&a[0]+e[1]<s.width()-i.outerWidth(!1)],c="yx"!==n.axis||l[0]||l[1]?"all":"none";"x"===n.axis||l[0]||X(t,e[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:c,dur:r}),"y"===n.axis||l[1]||X(t,e[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:c,dur:r})},t[0]._focusTimer))})},L=function(){var t=e(this),i=t.data(a),n=a+"_"+i.idx,r=e("#mCSB_"+i.idx+"_container").parent();r.bind("scroll."+n,function(){(0!==r.scrollTop()||0!==r.scrollLeft())&&e(".mCSB_"+i.idx+"_scrollbar").css("visibility","hidden")})},B=function(){var t=e(this),i=t.data(a),n=i.opt,r=i.sequential,o=a+"_"+i.idx,s=".mCSB_"+i.idx+"_scrollbar",l=e(s+">a");l.bind("mousedown."+o+" touchstart."+o+" pointerdown."+o+" MSPointerDown."+o+" mouseup."+o+" touchend."+o+" pointerup."+o+" MSPointerUp."+o+" mouseout."+o+" pointerout."+o+" MSPointerOut."+o+" click."+o,function(a){function o(e,i){r.scrollAmount=n.snapAmount||n.scrollButtons.scrollAmount,$(t,e,i)}if(a.preventDefault(),J(a)){var s=e(this).attr("class");switch(r.type=n.scrollButtons.scrollType,a.type){case"mousedown":case"touchstart":case"pointerdown":case"MSPointerDown":if("stepped"===r.type)return;c=!0,i.tweenRunning=!1,o("on",s);break;case"mouseup":case"touchend":case"pointerup":case"MSPointerUp":case"mouseout":case"pointerout":case"MSPointerOut":if("stepped"===r.type)return;c=!1,r.dir&&o("off",s);break;case"click":if("stepped"!==r.type||i.tweenRunning)return;o("on",s)}}})},W=function(){function t(t){function a(e,t){o.type=r.keyboard.scrollType,o.scrollAmount=r.snapAmount||r.keyboard.scrollAmount,"stepped"===o.type&&n.tweenRunning||$(i,e,t)}switch(t.type){case"blur":n.tweenRunning&&o.dir&&a("off",null);break;case"keydown":case"keyup":var s=t.keyCode?t.keyCode:t.which,l="on";if("x"!==r.axis&&(38===s||40===s)||"y"!==r.axis&&(37===s||39===s)){if((38===s||40===s)&&!n.overflowed[0]||(37===s||39===s)&&!n.overflowed[1])return;"keyup"===t.type&&(l="off"),e(document.activeElement).is(d)||(t.preventDefault(),t.stopImmediatePropagation(),a(l,s))}else if(33===s||34===s){if((n.overflowed[0]||n.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),"keyup"===t.type){Y(i);var h=34===s?-1:1;if("x"===r.axis||"yx"===r.axis&&n.overflowed[1]&&!n.overflowed[0])var p="x",f=Math.abs(c[0].offsetLeft)-.9*h*u.width();else var p="y",f=Math.abs(c[0].offsetTop)-.9*h*u.height();X(i,f.toString(),{dir:p,scrollEasing:"mcsEaseInOut"})}}else if((35===s||36===s)&&!e(document.activeElement).is(d)&&((n.overflowed[0]||n.overflowed[1])&&(t.preventDefault(),t.stopImmediatePropagation()),"keyup"===t.type)){if("x"===r.axis||"yx"===r.axis&&n.overflowed[1]&&!n.overflowed[0])var p="x",f=35===s?Math.abs(u.width()-c.outerWidth(!1)):0;else var p="y",f=35===s?Math.abs(u.height()-c.outerHeight(!1)):0;X(i,f.toString(),{dir:p,scrollEasing:"mcsEaseInOut"})}}}var i=e(this),n=i.data(a),r=n.opt,o=n.sequential,s=a+"_"+n.idx,l=e("#mCSB_"+n.idx),c=e("#mCSB_"+n.idx+"_container"),u=c.parent(),d="input,textarea,select,datalist,keygen,[contenteditable='true']",h=c.find("iframe"),p=["blur."+s+" keydown."+s+" keyup."+s];h.length&&h.each(function(){e(this).load(function(){P(this)&&e(this.contentDocument||this.contentWindow.document).bind(p[0],function(e){t(e)})})}),l.attr("tabindex","0").bind(p[0],function(e){t(e)})},$=function(t,i,n,r,o){function s(e){var i="stepped"!==h.type,a=o?o:e?i?m/1.5:g:1e3/60,n=e?i?7.5:40:2.5,l=[Math.abs(p[0].offsetTop),Math.abs(p[0].offsetLeft)],u=[c.scrollRatio.y>10?10:c.scrollRatio.y,c.scrollRatio.x>10?10:c.scrollRatio.x],d="x"===h.dir[0]?l[1]+h.dir[1]*u[1]*n:l[0]+h.dir[1]*u[0]*n,f="x"===h.dir[0]?l[1]+h.dir[1]*parseInt(h.scrollAmount):l[0]+h.dir[1]*parseInt(h.scrollAmount),v="auto"!==h.scrollAmount?f:d,y=r?r:e?i?"mcsLinearOut":"mcsEaseInOut":"mcsLinear",b=e?!0:!1;return e&&17>a&&(v="x"===h.dir[0]?l[1]:l[0]),X(t,v.toString(),{dir:h.dir[0],scrollEasing:y,dur:a,onComplete:b}),e?void(h.dir=!1):(clearTimeout(h.step),void(h.step=setTimeout(function(){s()},a)))}function l(){clearTimeout(h.step),Z(h,"step"),Y(t)}var c=t.data(a),d=c.opt,h=c.sequential,p=e("#mCSB_"+c.idx+"_container"),f="stepped"===h.type?!0:!1,m=d.scrollInertia<26?26:d.scrollInertia,g=d.scrollInertia<1?17:d.scrollInertia;switch(i){case"on":if(h.dir=[n===u[16]||n===u[15]||39===n||37===n?"x":"y",n===u[13]||n===u[15]||38===n||37===n?-1:1],Y(t),te(n)&&"stepped"===h.type)return;s(f);break;case"off":l(),(f||c.tweenRunning&&h.dir)&&s(!0)}},z=function(t){var i=e(this).data(a).opt,n=[];return"function"==typeof t&&(t=t()),t instanceof Array?n=t.length>1?[t[0],t[1]]:"x"===i.axis?[null,t[0]]:[t[0],null]:(n[0]=t.y?t.y:t.x||"x"===i.axis?null:t,n[1]=t.x?t.x:t.y||"y"===i.axis?null:t),"function"==typeof n[0]&&(n[0]=n[0]()),"function"==typeof n[1]&&(n[1]=n[1]()),n},N=function(t,i){if(null!=t&&"undefined"!=typeof t){var n=e(this),r=n.data(a),o=r.opt,s=e("#mCSB_"+r.idx+"_container"),l=s.parent(),c=typeof t;i||(i="x"===o.axis?"x":"y");var u="x"===i?s.outerWidth(!1):s.outerHeight(!1),h="x"===i?s[0].offsetLeft:s[0].offsetTop,p="x"===i?"left":"top";switch(c){case"function":return t();case"object":var f=t.jquery?t:e(t);if(!f.length)return;return"x"===i?ie(f)[1]:ie(f)[0];case"string":case"number":if(te(t))return Math.abs(t);if(-1!==t.indexOf("%"))return Math.abs(u*parseInt(t)/100);if(-1!==t.indexOf("-="))return Math.abs(h-parseInt(t.split("-=")[1]));if(-1!==t.indexOf("+=")){var m=h+parseInt(t.split("+=")[1]);return m>=0?0:Math.abs(m)}if(-1!==t.indexOf("px")&&te(t.split("px")[0]))return Math.abs(t.split("px")[0]);if("top"===t||"left"===t)return 0;if("bottom"===t)return Math.abs(l.height()-s.outerHeight(!1));if("right"===t)return Math.abs(l.width()-s.outerWidth(!1));if("first"===t||"last"===t){var f=s.find(":"+t);return"x"===i?ie(f)[1]:ie(f)[0]}return e(t).length?"x"===i?ie(e(t))[1]:ie(e(t))[0]:(s.css(p,t),void d.update.call(null,n[0]))}}},U=function(t){function i(){clearTimeout(p[0].autoUpdate),p[0].autoUpdate=setTimeout(function(){return h.advanced.updateOnSelectorChange&&(f=o(),f!==w)?(s(3),void(w=f)):(h.advanced.updateOnContentResize&&(m=[p.outerHeight(!1),p.outerWidth(!1),v.height(),v.width(),b()[0],b()[1]],(m[0]!==x[0]||m[1]!==x[1]||m[2]!==x[2]||m[3]!==x[3]||m[4]!==x[4]||m[5]!==x[5])&&(s(m[0]!==x[0]||m[1]!==x[1]),x=m)),h.advanced.updateOnImageLoad&&(g=n(),g!==_&&(p.find("img").each(function(){r(this)}),_=g)),void((h.advanced.updateOnSelectorChange||h.advanced.updateOnContentResize||h.advanced.updateOnImageLoad)&&i()))},60)}function n(){var e=0;return h.advanced.updateOnImageLoad&&(e=p.find("img").length),e}function r(t){function i(e,t){return function(){return t.apply(e,arguments)}}function a(){this.onload=null,e(t).addClass(u[2]),s(2)}if(e(t).hasClass(u[2]))return void s();var n=new Image;n.onload=i(n,a),n.src=t.src}function o(){h.advanced.updateOnSelectorChange===!0&&(h.advanced.updateOnSelectorChange="*");var t=0,i=p.find(h.advanced.updateOnSelectorChange);return h.advanced.updateOnSelectorChange&&i.length>0&&i.each(function(){t+=e(this).height()+e(this).width()}),t}function s(e){clearTimeout(p[0].autoUpdate),d.update.call(null,l[0],e)}var l=e(this),c=l.data(a),h=c.opt,p=e("#mCSB_"+c.idx+"_container");if(t)return clearTimeout(p[0].autoUpdate),void Z(p[0],"autoUpdate");var f,m,g,v=p.parent(),y=[e("#mCSB_"+c.idx+"_scrollbar_vertical"),e("#mCSB_"+c.idx+"_scrollbar_horizontal")],b=function(){return[y[0].is(":visible")?y[0].outerHeight(!0):0,y[1].is(":visible")?y[1].outerWidth(!0):0]},w=o(),x=[p.outerHeight(!1),p.outerWidth(!1),v.height(),v.width(),b()[0],b()[1]],_=n();i()},q=function(e,t,i){return Math.round(e/t)*t-i},Y=function(t){var i=t.data(a),n=e("#mCSB_"+i.idx+"_container,#mCSB_"+i.idx+"_container_wrapper,#mCSB_"+i.idx+"_dragger_vertical,#mCSB_"+i.idx+"_dragger_horizontal");n.each(function(){K.call(this)})},X=function(t,i,n){function r(e){return l&&c.callbacks[e]&&"function"==typeof c.callbacks[e]}function o(){return[c.callbacks.alwaysTriggerOffsets||b>=w[0]+_,c.callbacks.alwaysTriggerOffsets||-C>=b]}function s(){var e=[p[0].offsetTop,p[0].offsetLeft],i=[v[0].offsetTop,v[0].offsetLeft],a=[p.outerHeight(!1),p.outerWidth(!1)],r=[h.height(),h.width()];t[0].mcs={content:p,top:e[0],left:e[1],draggerTop:i[0],draggerLeft:i[1],topPct:Math.round(100*Math.abs(e[0])/(Math.abs(a[0])-r[0])),leftPct:Math.round(100*Math.abs(e[1])/(Math.abs(a[1])-r[1])),direction:n.dir}}var l=t.data(a),c=l.opt,u={trigger:"internal",dir:"y",scrollEasing:"mcsEaseOut",drag:!1,dur:c.scrollInertia,overwrite:"all",callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},n=e.extend(u,n),d=[n.dur,n.drag?0:n.dur],h=e("#mCSB_"+l.idx),p=e("#mCSB_"+l.idx+"_container"),f=p.parent(),m=c.callbacks.onTotalScrollOffset?z.call(t,c.callbacks.onTotalScrollOffset):[0,0],g=c.callbacks.onTotalScrollBackOffset?z.call(t,c.callbacks.onTotalScrollBackOffset):[0,0];if(l.trigger=n.trigger,(0!==f.scrollTop()||0!==f.scrollLeft())&&(e(".mCSB_"+l.idx+"_scrollbar").css("visibility","visible"),f.scrollTop(0).scrollLeft(0)),"_resetY"!==i||l.contentReset.y||(r("onOverflowYNone")&&c.callbacks.onOverflowYNone.call(t[0]),l.contentReset.y=1),"_resetX"!==i||l.contentReset.x||(r("onOverflowXNone")&&c.callbacks.onOverflowXNone.call(t[0]),l.contentReset.x=1),"_resetY"!==i&&"_resetX"!==i){switch(!l.contentReset.y&&t[0].mcs||!l.overflowed[0]||(r("onOverflowY")&&c.callbacks.onOverflowY.call(t[0]),l.contentReset.x=null),!l.contentReset.x&&t[0].mcs||!l.overflowed[1]||(r("onOverflowX")&&c.callbacks.onOverflowX.call(t[0]),l.contentReset.x=null),c.snapAmount&&(i=q(i,c.snapAmount,c.snapOffset)),n.dir){case"x":var v=e("#mCSB_"+l.idx+"_dragger_horizontal"),y="left",b=p[0].offsetLeft,w=[h.width()-p.outerWidth(!1),v.parent().width()-v.width()],x=[i,0===i?0:i/l.scrollRatio.x],_=m[1],C=g[1],j=_>0?_/l.scrollRatio.x:0,k=C>0?C/l.scrollRatio.x:0;break;case"y":var v=e("#mCSB_"+l.idx+"_dragger_vertical"),y="top",b=p[0].offsetTop,w=[h.height()-p.outerHeight(!1),v.parent().height()-v.height()],x=[i,0===i?0:i/l.scrollRatio.y],_=m[0],C=g[0],j=_>0?_/l.scrollRatio.y:0,k=C>0?C/l.scrollRatio.y:0}x[1]<0||0===x[0]&&0===x[1]?x=[0,0]:x[1]>=w[1]?x=[w[0],w[1]]:x[0]=-x[0],t[0].mcs||(s(),r("onInit")&&c.callbacks.onInit.call(t[0])),clearTimeout(p[0].onCompleteTimeout),(l.tweenRunning||!(0===b&&x[0]>=0||b===w[0]&&x[0]<=w[0]))&&(V(v[0],y,Math.round(x[1]),d[1],n.scrollEasing),V(p[0],y,Math.round(x[0]),d[0],n.scrollEasing,n.overwrite,{onStart:function(){n.callbacks&&n.onStart&&!l.tweenRunning&&(r("onScrollStart")&&(s(),c.callbacks.onScrollStart.call(t[0])),l.tweenRunning=!0,S(v),l.cbOffsets=o())},onUpdate:function(){n.callbacks&&n.onUpdate&&r("whileScrolling")&&(s(),c.callbacks.whileScrolling.call(t[0]))},onComplete:function(){if(n.callbacks&&n.onComplete){"yx"===c.axis&&clearTimeout(p[0].onCompleteTimeout);var e=p[0].idleTimer||0;p[0].onCompleteTimeout=setTimeout(function(){r("onScroll")&&(s(),c.callbacks.onScroll.call(t[0])),r("onTotalScroll")&&x[1]>=w[1]-j&&l.cbOffsets[0]&&(s(),c.callbacks.onTotalScroll.call(t[0])),r("onTotalScrollBack")&&x[1]<=k&&l.cbOffsets[1]&&(s(),c.callbacks.onTotalScrollBack.call(t[0])),l.tweenRunning=!1,p[0].idleTimer=0,S(v,"hide")},e)}}}))}},V=function(e,t,i,a,n,r,o){function s(){x.stop||(y||f.call(),y=G()-v,l(),y>=x.time&&(x.time=y>x.time?y+h-(y-x.time):y+h-1,x.time<y+1&&(x.time=y+1)),x.time<a?x.id=p(s):g.call())}function l(){a>0?(x.currVal=d(x.time,b,_,a,n),w[t]=Math.round(x.currVal)+"px"):w[t]=i+"px",m.call()}function c(){h=1e3/60,x.time=y+h,p=window.requestAnimationFrame?window.requestAnimationFrame:function(e){return l(),setTimeout(e,.01)},x.id=p(s)}function u(){null!=x.id&&(window.requestAnimationFrame?window.cancelAnimationFrame(x.id):clearTimeout(x.id),x.id=null)}function d(e,t,i,a,n){switch(n){case"linear":case"mcsLinear":return i*e/a+t;case"mcsLinearOut":return e/=a,e--,i*Math.sqrt(1-e*e)+t;case"easeInOutSmooth":return e/=a/2,1>e?i/2*e*e+t:(e--,-i/2*(e*(e-2)-1)+t);case"easeInOutStrong":return e/=a/2,1>e?i/2*Math.pow(2,10*(e-1))+t:(e--,i/2*(-Math.pow(2,-10*e)+2)+t);case"easeInOut":case"mcsEaseInOut":return e/=a/2,1>e?i/2*e*e*e+t:(e-=2,i/2*(e*e*e+2)+t);case"easeOutSmooth":return e/=a,e--,-i*(e*e*e*e-1)+t;case"easeOutStrong":return i*(-Math.pow(2,-10*e/a)+1)+t;case"easeOut":case"mcsEaseOut":default:var r=(e/=a)*e,o=r*e;return t+i*(.499999999999997*o*r+-2.5*r*r+5.5*o+-6.5*r+4*e)}}e._mTween||(e._mTween={top:{},left:{}});var h,p,o=o||{},f=o.onStart||function(){},m=o.onUpdate||function(){},g=o.onComplete||function(){},v=G(),y=0,b=e.offsetTop,w=e.style,x=e._mTween[t];"left"===t&&(b=e.offsetLeft);var _=i-b;x.stop=0,"none"!==r&&u(),c()},G=function(){return window.performance&&window.performance.now?window.performance.now():window.performance&&window.performance.webkitNow?window.performance.webkitNow():Date.now?Date.now():(new Date).getTime()},K=function(){var e=this;e._mTween||(e._mTween={top:{},left:{}});for(var t=["top","left"],i=0;i<t.length;i++){var a=t[i];e._mTween[a].id&&(window.requestAnimationFrame?window.cancelAnimationFrame(e._mTween[a].id):clearTimeout(e._mTween[a].id),e._mTween[a].id=null,e._mTween[a].stop=1)}},Z=function(e,t){try{delete e[t]}catch(i){e[t]=null}},J=function(e){return!(e.which&&1!==e.which)},ee=function(e){var t=e.originalEvent.pointerType;return!(t&&"touch"!==t&&2!==t)},te=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},ie=function(e){var t=e.parents(".mCSB_container");return[e.offset().top-t.offset().top,e.offset().left-t.offset().left]};e.fn[i]=function(t){return d[t]?d[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):d.init.apply(this,arguments)},e[i]=function(t){return d[t]?d[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void e.error("Method "+t+" does not exist"):d.init.apply(this,arguments)},e[i].defaults=r,window[i]=!0,e(window).load(function(){e(n)[i](),e.extend(e.expr[":"],{mcsInView:e.expr[":"].mcsInView||function(t){var i,a,n=e(t),r=n.parents(".mCSB_container");return r.length?(i=r.parent(),a=[r[0].offsetTop,r[0].offsetLeft],a[0]+ie(n)[0]>=0&&a[0]+ie(n)[0]<i.height()-n.outerHeight(!1)&&a[1]+ie(n)[1]>=0&&a[1]+ie(n)[1]<i.width()-n.outerWidth(!1)):void 0},mcsOverflow:e.expr[":"].mcsOverflow||function(t){var i=e(t).data(a);return i?i.overflowed[0]||i.overflowed[1]:void 0}})})})}),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){"use strict";var t=e(window),i=e(document),a=window.location,n=!0,r=!1,o=null,s=NaN,l=1/0,c="undefined",u="directive",d=".cropper",h=/^(e|n|w|s|ne|nw|sw|se|all|crop|move|zoom)#x2F;,p=/^(x|y|width|height)#x2F;,f=/^(naturalWidth|naturalHeight|width|height|aspectRatio|ratio|rotate)#x2F;,m="cropper-modal",g="cropper-hidden",v="cropper-invisible",y="cropper-move",b="cropper-crop",w="cropper-disabled",x="mousedown touchstart",_="mousemove touchmove",C="mouseup mouseleave touchend touchleave touchcancel",S="wheel mousewheel DOMMouseScroll",j="resize"+d,k="dblclick",Q="build"+d,T="built"+d,D="dragstart"+d,O="dragmove"+d,E="dragend"+d,M=function(e){return"number"==typeof e},I=function(e,t){var i=[];return"number"==typeof t&&i.push(t),i.slice.apply(e,i)},A=function(e,t){var i=I(arguments,2);return function(){return e.apply(t,i.concat(I(arguments)))}},P=function(t,i){this.element=t,this.$element=e(t),this.defaults=e.extend({},P.DEFAULTS,e.isPlainObject(i)?i:{}),this.$original=o,this.ready=r,this.built=r,this.cropped=r,this.rotated=r,this.disabled=r,this.replaced=r,this.init()},R=Math.sqrt,H=Math.min,F=Math.max,L=Math.abs,B=Math.sin,W=Math.cos,$=parseFloat;P.prototype={constructor:P,support:{canvas:e.isFunction(e("<canvas>")[0].getContext)},init:function(){var t=this.defaults;e.each(t,function(e,i){switch(e){case"aspectRatio":t[e]=L($(i))||s;break;case"autoCropArea":t[e]=L($(i))||.8;break;case"minWidth":case"minHeight":t[e]=L($(i))||0;break;case"maxWidth":case"maxHeight":t[e]=L($(i))||l}}),this.image={rotate:0},this.load()},load:function(){var t,i,a=this,r=this.$element,o=this.element,s=this.image,l="";r.is("img")?i=r.prop("src"):r.is("canvas")&&this.support.canvas&&(i=o.toDataURL()),i&&(this.replaced&&(s.rotate=0),this.defaults.checkImageOrigin&&(r.prop("crossOrigin")||this.isCrossOriginURL(i))&&(l=" crossOrigin"),this.$clone=t=e("<img"+l+' src="'+i+'">'),t.one("load",function(){s.naturalWidth=this.naturalWidth||t.width(),s.naturalHeight=this.naturalHeight||t.height(),s.aspectRatio=s.naturalWidth/s.naturalHeight,a.url=i,a.ready=n,a.build()}),t.addClass(v).prependTo("body"))},isCrossOriginURL:function(e){var t=e.match(/^(https?:)\/\/([^\:\/\?#]+):?(\d*)/i);return!t||t[1]===a.protocol&&t[2]===a.hostname&&t[3]===a.port?r:n},build:function(){var t,i,a=this.$element,o=this.defaults;this.ready&&(this.built&&this.unbuild(),a.one(Q,o.build),t=e.Event(Q),a.trigger(t),t.isDefaultPrevented()||(this.$cropper=i=e(P.TEMPLATE),a.addClass(g),this.$clone.removeClass(v).prependTo(i),this.rotated||(this.$original=this.$clone.clone(),this.$original.addClass(g).prependTo(this.$cropper),this.originalImage=e.extend({},this.image)),this.$container=a.parent(),this.$container.append(i),this.$canvas=i.find(".cropper-canvas"),this.$dragger=i.find(".cropper-dragger"),this.$viewer=i.find(".cropper-viewer"),o.autoCrop?this.cropped=n:this.$dragger.addClass(g),o.dragCrop&&this.setDragMode("crop"),o.modal&&this.$canvas.addClass(m),!o.dashed&&this.$dragger.find(".cropper-dashed").addClass(g),!o.movable&&this.$dragger.find(".cropper-face").data(u,"move"),!o.resizable&&this.$dragger.find(".cropper-line, .cropper-point").addClass(g),
7
+ this.addListeners(),this.initPreview(),this.built=n,this.update(),this.replaced=r,a.one(T,o.built),a.trigger(T)))},unbuild:function(){this.built&&(this.built=r,this.removeListeners(),this.$preview.empty(),this.$preview=o,this.$dragger=o,this.$canvas=o,this.$container=o,this.$cropper.remove(),this.$cropper=o)},update:function(e){this.initContainer(),this.initCropper(),this.initImage(),this.initDragger(),e?(this.setData(e,n),this.setDragMode("crop")):this.setData(this.defaults.data)},resize:function(){clearTimeout(this.resizing),this.resizing=setTimeout(e.proxy(this.update,this,this.getData()),200)},preview:function(){var t=this.image,i=this.dragger,a=t.width,n=t.height,r=i.left-t.left,o=i.top-t.top;this.$viewer.find("img").css({width:a,height:n,marginLeft:-r,marginTop:-o}),this.$preview.each(function(){var t=e(this),s=t.width()/i.width;t.find("img").css({width:a*s,height:n*s,marginLeft:-r*s,marginTop:-o*s})})},addListeners:function(){var a=this.defaults;this.$element.on(D,a.dragstart).on(O,a.dragmove).on(E,a.dragend),this.$cropper.on(x,e.proxy(this.dragstart,this)).on(k,e.proxy(this.dblclick,this)),a.zoomable&&this.$cropper.on(S,e.proxy(this.wheel,this)),a.multiple?this.$cropper.on(_,e.proxy(this.dragmove,this)).on(C,e.proxy(this.dragend,this)):i.on(_,this._dragmove=A(this.dragmove,this)).on(C,this._dragend=A(this.dragend,this)),t.on(j,this._resize=A(this.resize,this))},removeListeners:function(){var e=this.defaults;this.$element.off(D,e.dragstart).off(O,e.dragmove).off(E,e.dragend),this.$cropper.off(x,this.dragstart).off(k,this.dblclick),e.zoomable&&this.$cropper.off(S,this.wheel),e.multiple?this.$cropper.off(_,this.dragmove).off(C,this.dragend):i.off(_,this._dragmove).off(C,this._dragend),t.off(j,this._resize)},initPreview:function(){var t='<img src="'+this.url+'">';this.$preview=e(this.defaults.preview),this.$viewer.html(t),this.$preview.html(t).find("img").css("cssText","min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;")},initContainer:function(){var e=this.$container;e!==o&&(this.container={width:F(e.width(),300),height:F(e.height(),150)})},initCropper:function(){var e,t=this.container,i=this.image;i.naturalWidth*t.height/i.naturalHeight-t.width>=0?(e={width:t.width,height:t.width/i.aspectRatio,left:0},e.top=(t.height-e.height)/2):(e={width:t.height*i.aspectRatio,height:t.height,top:0},e.left=(t.width-e.width)/2),this.$cropper.css({width:e.width,height:e.height,left:e.left,top:e.top}),this.cropper=e},initImage:function(){var t=this.image,i=this.cropper,a={_width:i.width,_height:i.height,width:i.width,height:i.height,left:0,top:0,ratio:i.width/t.naturalWidth};this.defaultImage=e.extend({},t,a),t._width!==i.width||t._height!==i.height?e.extend(t,a):(t=e.extend({},a,t),this.replaced&&(t.ratio=a.ratio)),this.image=t,this.renderImage()},renderImage:function(e){var t=this.image;"zoom"===e&&(t.left-=(t.width-t.oldWidth)/2,t.top-=(t.height-t.oldHeight)/2),t.left=H(F(t.left,t._width-t.width),0),t.top=H(F(t.top,t._height-t.height),0),this.$clone.css({width:t.width,height:t.height,marginLeft:t.left,marginTop:t.top}),e&&(this.defaults.done(this.getData()),this.preview())},initDragger:function(){var t,i=this.defaults,a=this.cropper,n=i.aspectRatio||this.image.aspectRatio,r=this.image.ratio;t=a.height*n-a.width>=0?{height:a.width/n,width:a.width,left:0,top:(a.height-a.width/n)/2,maxWidth:a.width,maxHeight:a.width/n}:{height:a.height,width:a.height*n,left:(a.width-a.height*n)/2,top:0,maxWidth:a.height*n,maxHeight:a.height},t.minWidth=0,t.minHeight=0,i.aspectRatio?(isFinite(i.maxWidth)?(t.maxWidth=H(t.maxWidth,i.maxWidth*r),t.maxHeight=t.maxWidth/n):isFinite(i.maxHeight)&&(t.maxHeight=H(t.maxHeight,i.maxHeight*r),t.maxWidth=t.maxHeight*n),i.minWidth>0?(t.minWidth=F(0,i.minWidth*r),t.minHeight=t.minWidth/n):i.minHeight>0&&(t.minHeight=F(0,i.minHeight*r),t.minWidth=t.minHeight*n)):(t.maxWidth=H(t.maxWidth,i.maxWidth*r),t.maxHeight=H(t.maxHeight,i.maxHeight*r),t.minWidth=F(0,i.minWidth*r),t.minHeight=F(0,i.minHeight*r)),t.minWidth=H(t.maxWidth,t.minWidth),t.minHeight=H(t.maxHeight,t.minHeight),t.height*=i.autoCropArea,t.width*=i.autoCropArea,t.left=(a.width-t.width)/2,t.top=(a.height-t.height)/2,t.oldLeft=t.left,t.oldTop=t.top,this.defaultDragger=t,this.dragger=e.extend({},t)},renderDragger:function(){var e=this.dragger,t=this.cropper;e.width>e.maxWidth?(e.width=e.maxWidth,e.left=e.oldLeft):e.width<e.minWidth&&(e.width=e.minWidth,e.left=e.oldLeft),e.height>e.maxHeight?(e.height=e.maxHeight,e.top=e.oldTop):e.height<e.minHeight&&(e.height=e.minHeight,e.top=e.oldTop),e.left=H(F(e.left,0),t.width-e.width),e.top=H(F(e.top,0),t.height-e.height),e.oldLeft=e.left,e.oldTop=e.top,this.dragger=e,this.disabled||this.defaults.done(this.getData()),this.$dragger.css({width:e.width,height:e.height,left:e.left,top:e.top}),this.preview()},reset:function(t){this.cropped&&(t&&(this.defaults.data={}),this.image=e.extend({},this.defaultImage),this.renderImage(),this.dragger=e.extend({},this.defaultDragger),this.setData(this.defaults.data))},clear:function(){this.cropped&&(this.cropped=r,this.setData({x:0,y:0,width:0,height:0}),this.$canvas.removeClass(m),this.$dragger.addClass(g))},destroy:function(){var e=this.$element;this.ready&&(this.unbuild(),e.removeClass(g).removeData("cropper"),this.rotated&&e.attr("src",this.$original.attr("src")))},replace:function(t,i){var a,o=this,s=this.$element,l=this.element;t&&t!==this.url&&t!==s.attr("src")&&(i||(this.rotated=r,this.replaced=n),s.is("img")?(s.attr("src",t),this.load()):s.is("canvas")&&this.support.canvas&&(a=l.getContext("2d"),e('<img src="'+t+'">').one("load",function(){l.width=this.width,l.height=this.height,a.clearRect(0,0,l.width,l.height),a.drawImage(this,0,0),o.load()})))},setData:function(t,i){var a=this.cropper,n=this.dragger,r=this.image,s=this.defaults.aspectRatio;this.built&&typeof t!==c&&((t===o||e.isEmptyObject(t))&&(n=e.extend({},this.defaultDragger)),e.isPlainObject(t)&&!e.isEmptyObject(t)&&(i||(this.defaults.data=t),t=this.transformData(t),M(t.x)&&t.x<=a.width-r.left&&(n.left=t.x+r.left),M(t.y)&&t.y<=a.height-r.top&&(n.top=t.y+r.top),s?M(t.width)&&t.width<=n.maxWidth&&t.width>=n.minWidth?(n.width=t.width,n.height=n.width/s):M(t.height)&&t.height<=n.maxHeight&&t.height>=n.minHeight&&(n.height=t.height,n.width=n.height*s):(M(t.width)&&t.width<=n.maxWidth&&t.width>=n.minWidth&&(n.width=t.width),M(t.height)&&t.height<=n.maxHeight&&t.height>=n.minHeight&&(n.height=t.height))),this.dragger=n,this.renderDragger())},getData:function(e){var t=this.dragger,i=this.image,a={};return this.built&&(a={x:t.left-i.left,y:t.top-i.top,width:t.width,height:t.height},a=this.transformData(a,n,e)),a},transformData:function(t,i,a){var n=this.image.ratio,r={};return e.each(t,function(e,t){t=$(t),p.test(e)&&!isNaN(t)&&(r[e]=i?a?Math.round(t/n):t/n:t*n)}),r},setAspectRatio:function(e){var t="auto"===e;e=$(e),(t||!isNaN(e)&&e>0)&&(this.defaults.aspectRatio=t?s:e,this.built&&(this.initDragger(),this.renderDragger()))},getImageData:function(){var t={};return this.ready&&e.each(this.image,function(e,i){f.test(e)&&(t[e]=i)}),t},getDataURL:function(t,i,a){var n,r=e("<canvas>")[0],o=this.getData(),s="";return e.isPlainObject(t)||(a=i,i=t,t={}),t=e.extend({width:o.width,height:o.height},t),this.cropped&&this.support.canvas&&(r.width=t.width,r.height=t.height,n=r.getContext("2d"),"image/jpeg"===i&&(n.fillStyle="#fff",n.fillRect(0,0,t.width,t.height)),n.drawImage(this.$clone[0],o.x,o.y,o.width,o.height,0,0,t.width,t.height),s=r.toDataURL(i,a)),s},setDragMode:function(e){var t=this.$canvas,i=this.defaults,a=r,o=r;if(this.built&&!this.disabled){switch(e){case"crop":i.dragCrop&&(a=n,t.data(u,e));break;case"move":o=n,t.data(u,e);break;default:t.removeData(u)}t.toggleClass(b,a).toggleClass(y,o)}},enable:function(){this.built&&(this.disabled=r,this.$cropper.removeClass(w))},disable:function(){this.built&&(this.disabled=n,this.$cropper.addClass(w))},rotate:function(e){var t=this.image;e=$(e)||0,this.built&&0!==e&&!this.disabled&&this.defaults.rotatable&&this.support.canvas&&(this.rotated=n,e=t.rotate=(t.rotate+e)%360,this.replace(this.getRotatedDataURL(e),!0))},getRotatedDataURL:function(t){var i=e("<canvas>")[0],a=i.getContext("2d"),n=t*Math.PI/180,r=L(t)%180,o=r>90?180-r:r,s=o*Math.PI/180,l=this.originalImage,c=l.naturalWidth,u=l.naturalHeight,d=L(c*W(s)+u*B(s)),h=L(c*B(s)+u*W(s));return i.width=d,i.height=h,a.save(),a.translate(d/2,h/2),a.rotate(n),a.drawImage(this.$original[0],-c/2,-u/2,c,u),a.restore(),i.toDataURL()},zoom:function(e){var t,i,a,n=this.image;e=$(e),this.built&&e&&!this.disabled&&this.defaults.zoomable&&(t=n.width*(1+e),i=n.height*(1+e),a=t/n._width,a>10||(1>a&&(t=n._width,i=n._height),1>=a?this.setDragMode("crop"):this.setDragMode("move"),n.oldWidth=n.width,n.oldHeight=n.height,n.width=t,n.height=i,n.ratio=n.width/n.naturalWidth,this.renderImage("zoom")))},dblclick:function(){this.disabled||(this.$canvas.hasClass(b)?this.setDragMode("move"):this.setDragMode("crop"))},wheel:function(e){var t,i=e.originalEvent,a=117.25,n=5,r=166.66665649414062,o=.1;this.disabled||(e.preventDefault(),i.deltaY?(t=i.deltaY,t=t%n===0?t/n:t%a===0?t/a:t/r):t=i.wheelDelta?-i.wheelDelta/120:i.detail?i.detail/3:0,this.zoom(t*o))},dragstart:function(t){var i,a,o,s=t.originalEvent.touches,l=t;if(!this.disabled){if(s){if(o=s.length,o>1){if(!this.defaults.zoomable||2!==o)return;l=s[1],this.startX2=l.pageX,this.startY2=l.pageY,i="zoom"}l=s[0]}if(i=i||e(l.target).data(u),h.test(i)){if(t.preventDefault(),a=e.Event(D),this.$element.trigger(a),a.isDefaultPrevented())return;this.directive=i,this.cropping=r,this.startX=l.pageX,this.startY=l.pageY,"crop"===i&&(this.cropping=n,this.$canvas.addClass(m))}}},dragmove:function(t){var i,a,n=t.originalEvent.touches,r=t;if(!this.disabled){if(n){if(a=n.length,a>1){if(!this.defaults.zoomable||2!==a)return;r=n[1],this.endX2=r.pageX,this.endY2=r.pageY}r=n[0]}if(this.directive){if(t.preventDefault(),i=e.Event(O),this.$element.trigger(i),i.isDefaultPrevented())return;this.endX=r.pageX,this.endY=r.pageY,this.dragging()}}},dragend:function(t){var i;if(!this.disabled&&this.directive){if(t.preventDefault(),i=e.Event(E),this.$element.trigger(i),i.isDefaultPrevented())return;this.cropping&&(this.cropping=r,this.$canvas.toggleClass(m,this.cropped&&this.defaults.modal)),this.directive=""}},dragging:function(){var e,t=this.directive,i=this.image,a=this.cropper,o=a.width,s=a.height,l=this.dragger,c=l.width,u=l.height,d=l.left,h=l.top,p=d+c,f=h+u,m=n,v=this.defaults,y=v.aspectRatio,b={x:this.endX-this.startX,y:this.endY-this.startY};switch(y&&(b.X=b.y*y,b.Y=b.x/y),t){case"all":d+=b.x,h+=b.y;break;case"e":if(b.x>=0&&(p>=o||y&&(0>=h||f>=s))){m=r;break}c+=b.x,y&&(u=c/y,h-=b.Y/2),0>c&&(t="w",c=0);break;case"n":if(b.y<=0&&(0>=h||y&&(0>=d||p>=o))){m=r;break}u-=b.y,h+=b.y,y&&(c=u*y,d+=b.X/2),0>u&&(t="s",u=0);break;case"w":if(b.x<=0&&(0>=d||y&&(0>=h||f>=s))){m=r;break}c-=b.x,d+=b.x,y&&(u=c/y,h+=b.Y/2),0>c&&(t="e",c=0);break;case"s":if(b.y>=0&&(f>=s||y&&(0>=d||p>=o))){m=r;break}u+=b.y,y&&(c=u*y,d-=b.X/2),0>u&&(t="n",u=0);break;case"ne":if(y){if(b.y<=0&&(0>=h||p>=o)){m=r;break}u-=b.y,h+=b.y,c=u*y}else b.x>=0?o>p?c+=b.x:b.y<=0&&0>=h&&(m=r):c+=b.x,b.y<=0?h>0&&(u-=b.y,h+=b.y):(u-=b.y,h+=b.y);0>u&&(t="sw",u=0,c=0);break;case"nw":if(y){if(b.y<=0&&(0>=h||0>=d)){m=r;break}u-=b.y,h+=b.y,c=u*y,d+=b.X}else b.x<=0?d>0?(c-=b.x,d+=b.x):b.y<=0&&0>=h&&(m=r):(c-=b.x,d+=b.x),b.y<=0?h>0&&(u-=b.y,h+=b.y):(u-=b.y,h+=b.y);0>u&&(t="se",u=0,c=0);break;case"sw":if(y){if(b.x<=0&&(0>=d||f>=s)){m=r;break}c-=b.x,d+=b.x,u=c/y}else b.x<=0?d>0?(c-=b.x,d+=b.x):b.y>=0&&f>=s&&(m=r):(c-=b.x,d+=b.x),b.y>=0?s>f&&(u+=b.y):u+=b.y;0>c&&(t="ne",u=0,c=0);break;case"se":if(y){if(b.x>=0&&(p>=o||f>=s)){m=r;break}c+=b.x,u=c/y}else b.x>=0?o>p?c+=b.x:b.y>=0&&f>=s&&(m=r):c+=b.x,b.y>=0?s>f&&(u+=b.y):u+=b.y;0>c&&(t="nw",u=0,c=0);break;case"move":i.left+=b.x,i.top+=b.y,this.renderImage("move"),m=r;break;case"zoom":v.zoomable&&(this.zoom(function(e,t,i,a,n,r){return(R(n*n+r*r)-R(i*i+a*a))/R(e*e+t*t)}(i.width,i.height,L(this.startX-this.startX2),L(this.startY-this.startY2),L(this.endX-this.endX2),L(this.endY-this.endY2))),this.endX2=this.startX2,this.endY2=this.startY2);break;case"crop":b.x&&b.y&&(e=this.$cropper.offset(),d=this.startX-e.left,h=this.startY-e.top,c=l.minWidth,u=l.minHeight,b.x>0?b.y>0?t="se":(t="ne",h-=u):b.y>0?(t="sw",d-=c):(t="nw",d-=c,h-=u),this.cropped||(this.cropped=n,this.$dragger.removeClass(g)))}m&&(l.width=c,l.height=u,l.left=d,l.top=h,this.directive=t,this.renderDragger()),this.startX=this.endX,this.startY=this.endY}},P.TEMPLATE=function(e,t){return t=t.split(","),e.replace(/\d+/g,function(e){return t[e]})}('<0 6="5-container"><0 6="5-canvas"></0><0 6="5-dragger"><1 6="5-viewer"></1><1 6="5-8 8-h"></1><1 6="5-8 8-v"></1><1 6="5-face" 3-2="all"></1><1 6="5-7 7-e" 3-2="e"></1><1 6="5-7 7-n" 3-2="n"></1><1 6="5-7 7-w" 3-2="w"></1><1 6="5-7 7-s" 3-2="s"></1><1 6="5-4 4-e" 3-2="e"></1><1 6="5-4 4-n" 3-2="n"></1><1 6="5-4 4-w" 3-2="w"></1><1 6="5-4 4-s" 3-2="s"></1><1 6="5-4 4-ne" 3-2="ne"></1><1 6="5-4 4-nw" 3-2="nw"></1><1 6="5-4 4-sw" 3-2="sw"></1><1 6="5-4 4-se" 3-2="se"></1></0></0>',"div,span,directive,data,point,cropper,class,line,dashed"),P.DEFAULTS={aspectRatio:"auto",autoCropArea:.8,data:{},done:e.noop,preview:"",multiple:r,autoCrop:n,dragCrop:n,dashed:n,modal:n,movable:n,resizable:n,zoomable:n,rotatable:n,checkImageOrigin:n,minWidth:0,minHeight:0,maxWidth:l,maxHeight:l,build:o,built:o,dragstart:o,dragmove:o,dragend:o},P.setDefaults=function(t){e.extend(P.DEFAULTS,t)},P.other=e.fn.cropper,e.fn.cropper=function(t){var i,a=I(arguments,1);return this.each(function(){var n,r=e(this),o=r.data("cropper");o||r.data("cropper",o=new P(this,t)),"string"==typeof t&&e.isFunction(n=o[t])&&(i=n.apply(o,a))}),typeof i!==c?i:this},e.fn.cropper.Constructor=P,e.fn.cropper.setDefaults=P.setDefaults,e.fn.cropper.noConflict=function(){return e.fn.cropper=P.other,this}}),function(e){function t(e,t){return"function"==typeof e?e.call(t):e}function i(e){for(;e=e.parentNode;)if(e==document)return!0;return!1}function a(t,i){this.$element=e(t),this.options=i,this.enabled=!0,this.fixTitle()}a.prototype={show:function(){var i=this.getTitle();if(i&&this.enabled){var a=this.tip();a.find(".tipsy-inner")[this.options.html?"html":"text"](i),a[0].className="tipsy",a.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).prependTo(document.body);var n,r=e.extend({},this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight}),o=a[0].offsetWidth,s=a[0].offsetHeight,l=t(this.options.gravity,this.$element[0]);switch(l.charAt(0)){case"n":n={top:r.top+r.height+this.options.offset,left:r.left+r.width/2-o/2};break;case"s":n={top:r.top-s-this.options.offset,left:r.left+r.width/2-o/2};break;case"e":n={top:r.top+r.height/2-s/2,left:r.left-o-this.options.offset};break;case"w":extra_gap=0,e("body").css("position").length>0&&"relative"==e("body").css("position")&&e("#wpadminbar").length&&(extra_gap=e("#wpadminbar").height()),n={top:r.top+r.height/2-s/2-extra_gap,left:r.left+r.width+this.options.offset}}2==l.length&&("w"==l.charAt(1)?n.left=r.left+r.width/2-15:n.left=r.left+r.width/2-o+15),a.css(n).addClass("tipsy-"+l),a.find(".tipsy-arrow")[0].className="tipsy-arrow tipsy-arrow-"+l.charAt(0),this.options.className&&a.addClass(t(this.options.className,this.$element[0])),this.options.fade?a.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:this.options.opacity}):a.css({visibility:"visible",opacity:this.options.opacity})}},hide:function(){this.options.fade?this.tip().stop().fadeOut(function(){e(this).remove()}):this.tip().remove()},fixTitle:function(){var e=this.$element;(e.attr("title")||"string"!=typeof e.attr("original-title"))&&e.attr("original-title",e.attr("title")||"").removeAttr("title")},getTitle:function(){var e,t=this.$element,i=this.options;this.fixTitle();var e,i=this.options;return"string"==typeof i.title?e=t.attr("title"==i.title?"original-title":i.title):"function"==typeof i.title&&(e=i.title.call(t[0])),e=(""+e).replace(/(^\s*|\s*$)/,""),e||i.fallback},tip:function(){return this.$tip||(this.$tip=e('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>'),this.$tip.data("tipsy-pointee",this.$element[0])),this.$tip},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled}},e.fn.tipsy=function(t){function i(i){var n=e.data(i,"tipsy");return n||(n=new a(i,e.fn.tipsy.elementOptions(i,t)),e.data(i,"tipsy",n)),n}function n(){var e=i(this);e.hoverState="in",0==t.delayIn?e.show():(e.fixTitle(),setTimeout(function(){"in"==e.hoverState&&e.show()},t.delayIn))}function r(){var e=i(this);e.hoverState="out",0==t.delayOut?e.hide():setTimeout(function(){"out"==e.hoverState&&e.hide()},t.delayOut)}if(t===!0)return this.data("tipsy");if("string"==typeof t){var o=this.data("tipsy");return o&&o[t](),this}if(t=e.extend({},e.fn.tipsy.defaults,t),t.live||this.each(function(){i(this)}),"manual"!=t.trigger){var s="hover"==t.trigger?"mouseenter":"focus",l="hover"==t.trigger?"mouseleave":"blur";t.live?e(document).on(s,this.selector,n).on(l,this.selector,r):this.bind(s,n).bind(l,r)}return this},e.fn.tipsy.defaults={className:null,delayIn:0,delayOut:0,fade:!1,fallback:"",gravity:"n",html:!1,live:!1,offset:0,opacity:.8,title:"title",trigger:"hover"},e.fn.tipsy.revalidate=function(){e(".tipsy").each(function(){var t=e.data(this,"tipsy-pointee");t&&i(t)||e(this).remove()})},e.fn.tipsy.elementOptions=function(t,i){return e.metadata?e.extend({},i,e(t).metadata()):i},e.fn.tipsy.autoNS=function(){return e(this).offset().top>e(document).scrollTop()+e(window).height()/2?"s":"n"},e.fn.tipsy.autoWE=function(){return e(this).offset().left>e(document).scrollLeft()+e(window).width()/2?"e":"w"},e.fn.tipsy.autoBounds=function(t,i){return function(){var a={ns:i[0],ew:i.length>1?i[1]:!1},n=e(document).scrollTop()+t,r=e(document).scrollLeft()+t,o=e(this);return o.offset().top<n&&(a.ns="n"),o.offset().left<r&&(a.ew="w"),e(window).width()+e(document).scrollLeft()-o.offset().left<t&&(a.ew="e"),e(window).height()+e(document).scrollTop()-o.offset().top<t&&(a.ns="s"),a.ns+(a.ew?a.ew:"")}}}(jQuery);var live_field,live_value,xhrValidateUsername=!1;jQuery(document).ready(function(){2==jQuery("input[data-key=user_password],input[data-key=confirm_user_password]").length&&UM_check_password_matched()}),jQuery(function(){jQuery(".um-search form *").keypress(function(e){return 13==e.which?(jQuery(".um-search form").submit(),!1):void 0}),jQuery(document).on("touchend",function(){jQuery(".select2-search, .select2-focusser").remove()})}),jQuery(window).load(function(){um_responsive(),um_modal_responsive()}),jQuery(window).resize(function(){responsive_Modal(),jQuery("img.cropper-hidden").cropper("destroy"),um_responsive(),um_modal_responsive()}),jQuery(document).ready(function(){jQuery(document).on("input change",".um-field input[type=text]",function(){live_field=jQuery(this).parents(".um-field").data("key"),live_value=jQuery(this).val(),um_conditional()}),jQuery(".um-field input[type=text]").trigger("input"),jQuery(document).on("change",".um-field select, .um-field input[type=radio], .um-field input[type=checkbox]",function(){live_field=jQuery(this).parents(".um-field").data("key"),live_value=jQuery(this).val(),jQuery(this).is(":checkbox")&&(jQuery(this).parents(".um-field").find("input:checked").length>1?(live_value="",jQuery(this).parents(".um-field").find("input:checked").each(function(){live_value=live_value+jQuery(this).val()+" "})):live_value=jQuery(this).parents(".um-field").find("input:checked").val()),jQuery(this).is(":radio")&&(live_value=jQuery(this).parents(".um-field").find("input[type=radio]:checked").val()),um_conditional()}),jQuery(".um-field select, .um-field input[type=radio], .um-field input[type=checkbox]").trigger("change")}),jQuery(document).ready(function(){jQuery(document).on("click",".um-dropdown a",function(e){return!1}),jQuery(document).on("click",".um-dropdown a.real_url",function(e){window.location=jQuery(this).attr("href")}),jQuery(document).on("click",".um-trigger-menu-on-click",function(e){return jQuery(".um-dropdown").hide(),menu=jQuery(this).find(".um-dropdown"),menu.show(),!1}),jQuery(document).on("click",".um-dropdown-hide",function(e){UM_hide_menus()}),jQuery(document).on("click","a.um-manual-trigger",function(){var e=jQuery(this).attr("data-child"),t=jQuery(this).attr("data-parent");jQuery(this).parents(t).find(e).trigger("click")}),jQuery(".um-tip-n").tipsy({gravity:"n",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-w").tipsy({gravity:"w",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-e").tipsy({gravity:"e",opacity:1,live:"a.live",offset:3}),jQuery(".um-tip-s").tipsy({gravity:"s",opacity:1,live:"a.live",offset:3}),jQuery(document).on("change",".um-field-area input[type=radio]",function(){var e=jQuery(this).parents(".um-field-area"),t=jQuery(this).parents("label");e.find(".um-field-radio").removeClass("active"),e.find(".um-field-radio").find("i").removeClass().addClass("um-icon-android-radio-button-off"),t.addClass("active"),t.find("i").removeClass().addClass("um-icon-android-radio-button-on")}),jQuery(document).on("change",".um-field-area input[type=checkbox]",function(){var e=(jQuery(this).parents(".um-field-area"),jQuery(this).parents("label"));e.hasClass("active")?(e.removeClass("active"),e.find("i").removeClass().addClass("um-icon-android-checkbox-outline-blank")):(e.addClass("active"),e.find("i").removeClass().addClass("um-icon-android-checkbox-outline"))}),jQuery(".um-datepicker").each(function(){if(elem=jQuery(this),""!=elem.attr("data-disabled_weekdays"))var e=JSON.parse(elem.attr("data-disabled_weekdays"));else var e=!1;var t=elem.attr("data-years"),i=elem.attr("data-date_min"),a=elem.attr("data-date_max"),i=i.length?new Date(i.split(",")):null,a=a.length?new Date(a.split(",")):null;elem.pickadate({selectYears:t,min:i,max:a,disable:e,format:elem.attr("data-format"),formatSubmit:"yyyy/mm/dd",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}})}),jQuery(".um-timepicker").each(function(){elem=jQuery(this),elem.pickatime({format:elem.attr("data-format"),interval:parseInt(elem.attr("data-intervals")),formatSubmit:"HH:i",hiddenName:!0,onOpen:function(){elem.blur()},onClose:function(){elem.blur()}})}),jQuery(".um-rating").raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,click:function(e,t){live_field=this.id,live_value=e,um_conditional()}}),jQuery(".um-rating-readonly").raty({half:!1,starType:"i",number:function(){return jQuery(this).attr("data-number")},score:function(){return jQuery(this).attr("data-score")},scoreName:function(){return jQuery(this).attr("data-key")},hints:!1,readOnly:!0}),jQuery(document).on("click",".um .um-single-image-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),i=jQuery(this).parents(".um-field").find(".um-single-image-preview img").attr("src");return t.find(".um-single-image-preview img").attr("src",""),t.find(".um-single-image-preview").hide(),t.find(".um-btn-auto-width").html("Upload"),t.find("input[type=hidden]").val(""),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_remove_file",src:i}}),!1}),jQuery(document).on("click",".um .um-single-file-preview a.cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field"),i=jQuery(this).parents(".um-field").find(".um-single-fileinfo a").attr("href");return t.find(".um-single-file-preview").hide(),t.find(".um-btn-auto-width").html("Upload"),t.find("input[type=hidden]").val(""),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_remove_file",src:i}}),!1}),jQuery(".um-s1").select2({allowClear:!0,minimumResultsForSearch:10}),jQuery(".um-s2").select2({allowClear:!1,minimumResultsForSearch:10}),jQuery(".um-s1,.um-s2").css({display:"block"}),jQuery(document).on("click",".um-field-group-head:not(.disabled)",function(){var e=jQuery(this).parents(".um-field-group"),t=e.data("max_entries");e.find(".um-field-group-body").is(":hidden")?e.find(".um-field-group-body").show():e.find(".um-field-group-body:first").clone().appendTo(e),increase_id=0,e.find(".um-field-group-body").each(function(){increase_id++,jQuery(this).find("input").each(function(){var e=jQuery(this);e.attr("id",e.data("key")+"-"+increase_id),e.attr("name",e.data("key")+"-"+increase_id),e.parent().parent().find("label").attr("for",e.data("key")+"-"+increase_id)})}),t>0&&e.find(".um-field-group-body").length==t&&jQuery(this).addClass("disabled")}),jQuery(document).on("click",".um-field-group-cancel",function(e){e.preventDefault();var t=jQuery(this).parents(".um-field-group"),i=t.data("max_entries");return t.find(".um-field-group-body").length>1?jQuery(this).parents(".um-field-group-body").remove():jQuery(this).parents(".um-field-group-body").hide(),i>0&&t.find(".um-field-group-body").length<i&&t.find(".um-field-group-head").removeClass("disabled"),!1}),jQuery(document).on("click",".um-ajax-paginate",function(e){e.preventDefault();var t=jQuery(this).parent();t.addClass("loading");var i=jQuery(this).data("args"),a=jQuery(this).data("hook"),n=jQuery(this).parents(".um").find(".um-ajax-items");return jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_ajax_paginate",hook:a,args:i},complete:function(){t.removeClass("loading")},success:function(e){t.remove(),n.append(e)}}),!1}),jQuery(document).on("click",".um-ajax-action",function(e){e.preventDefault();var t=jQuery(this).data("hook"),i=jQuery(this).data("user_id"),a=jQuery(this).data("arguments");return jQuery(this).data("js-remove")&&jQuery(this).parents("."+jQuery(this).data("js-remove")).fadeOut("fast"),jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_muted_action",hook:t,user_id:i,arguments:a},success:function(e){}}),!1})}),jQuery(document).ready(function(){jQuery(".um-members").each(function(){UM_Member_Grid(jQuery(this))}),jQuery(".um-member-connect").each(function(){0==jQuery(this).find("a").length&&jQuery(this).remove()}),jQuery(".um-member-meta-main").each(function(){0==jQuery(this).find(".um-member-metaline").length&&0==jQuery(this).find(".um-member-connect").find("a").length&&jQuery(this).remove()}),jQuery(document).on("click",".um-member-more a",function(e){e.preventDefault();var t=jQuery(this).parents(".um-member"),i=jQuery(this).parents(".um-members");return t.find(".um-member-more").hide(),t.find(".um-member-meta").slideDown(function(){UM_Member_Grid(i)}),t.find(".um-member-less").fadeIn(),setTimeout(function(){UM_Member_Grid(i)},100),!1}),jQuery(document).on("click",".um-member-less a",function(e){e.preventDefault();var t=jQuery(this).parents(".um-member"),i=jQuery(this).parents(".um-members");return t.find(".um-member-less").hide(),t.find(".um-member-meta").slideUp(function(){t.find(".um-member-more").fadeIn(),UM_Member_Grid(i)}),!1}),jQuery(document).on("click",".um-do-search",function(e){return e.preventDefault(),jQuery(this).parents("form").submit(),!1})}),jQuery(document).ready(function(){function e(){if("undefined"!=typeof jQuery("textarea[id=um-meta-bio]").val()){var e=jQuery("textarea[id=um-meta-bio]").attr("data-character-limit"),t=e-jQuery("textarea[id=um-meta-bio]").val().length;jQuery("span.um-meta-bio-character span.um-bio-limit").text(t),5>t?jQuery("span.um-meta-bio-character").css("color","red"):jQuery("span.um-meta-bio-character").css("color","")}}jQuery(".um-profile.um-viewing .um-profile-body .um-row").each(function(){var e=jQuery(this);0==e.find(".um-field").length&&(e.prev(".um-row-heading").remove(),e.remove())}),jQuery(".um-profile.um-viewing .um-profile-body").length&&0==jQuery(".um-profile.um-viewing .um-profile-body").find(".um-field").length&&(jQuery(".um-row-heading,.um-row").remove(),jQuery(".um-profile-note").show()),jQuery(document).on("click",".um-profile-save",function(e){return e.preventDefault(),jQuery(this).parents(".um").find("form").submit(),!1}),jQuery(document).on("click",".um-profile-edit-a",function(e){jQuery(this).addClass("active")}),jQuery(document).on("click",".um-cover a, .um-photo a",function(e){return e.preventDefault(),!1}),jQuery(document).on("click",".um-photo-modal",function(e){e.preventDefault();var t=jQuery(this).attr("data-src");return um_new_modal("um_view_photo","fit",!0,t),!1}),jQuery(document).on("click",".um-reset-profile-photo",function(e){jQuery(".um-profile-photo-img img").attr("src",jQuery(this).attr("data-default_src")),user_id=jQuery(this).attr("data-user_id"),metakey="profile_photo",jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_delete_profile_photo",metakey:metakey,user_id:user_id}})}),jQuery(document).on("click",".um-reset-cover-photo",function(e){jQuery(".um-cover-overlay").hide(),jQuery(".um-cover-e").html('<a href="#" class="um-cover-add um-manual-trigger" data-parent=".um-cover" data-child=".um-btn-auto-width"><span class="um-cover-add-i"><i class="um-icon-plus um-tip-n" title="Upload a cover photo"></i></span></a>'),jQuery(".um-dropdown").hide(),um_responsive(),user_id=jQuery(this).attr("data-user_id"),metakey="cover_photo",jQuery.ajax({url:um_scripts.ajaxurl,type:"post",data:{action:"ultimatemember_delete_cover_photo",metakey:metakey,user_id:user_id}})}),e(),jQuery("textarea[id=um-meta-bio]").change(e),jQuery("textarea[id=um-meta-bio]").keyup(e)}),jQuery(document).ready(function(){var e=jQuery(".um-account-main").attr("data-current_tab");e&&jQuery(".um-account-tab[data-tab="+e+"]").show(),jQuery(document).on("click",".um-account-side li a",function(e){e.preventDefault();var t=jQuery(this);t.parents("ul").find("li a").removeClass("current"),t.addClass("current");var i=jQuery(this).attr("href"),a=jQuery(this).attr("data-tab");return window.history.pushState("","",i),jQuery(".um-account-tab").hide(),jQuery(".um-account-tab[data-tab="+a+"]").fadeIn(),jQuery(".um-account-nav a").removeClass("current"),jQuery(".um-account-nav a[data-tab="+a+"]").addClass("current"),!1}),jQuery(document).on("click",".um-account-nav a",function(e){e.preventDefault();var t=jQuery(this).attr("data-tab"),i=jQuery(this).parents("div"),a=jQuery(this);return jQuery(".um-account-tab").hide(),a.hasClass("current")?(i.next(".um-account-tab").slideUp(),a.removeClass("current")):(i.next(".um-account-tab").slideDown(),a.parents("div").find("a").removeClass("current"),a.addClass("current")),jQuery(".um-account-side li a").removeClass("current"),jQuery(".um-account-side li a[data-tab="+t+"]").addClass("current"),!1})});
core/um-actions-access.php CHANGED
@@ -6,57 +6,57 @@
6
add_action('um_access_homepage_per_role','um_access_homepage_per_role');
7
function um_access_homepage_per_role() {
8
global $ultimatemember;
9
-
10
if ( !is_user_logged_in() ) return;
11
if ( is_admin() ) return;
12
if ( um_user('default_homepage') ) return;
13
if ( !um_user('redirect_homepage') ) return;
14
-
15
if( is_front_page() ) {
16
$ultimatemember->access->redirect_handler = um_user('redirect_homepage');
17
}
18
}
19
-
20
/***
21
*** @
22
***/
23
add_action('um_access_global_settings','um_access_global_settings');
24
function um_access_global_settings() {
25
global $post, $ultimatemember;
26
-
27
$access = um_get_option('accessible');
28
-
29
if ( $access == 2 && !is_user_logged_in() ) {
30
-
31
$redirect = um_get_option('access_redirect');
32
- if ( !$redirect )
33
$redirect = um_get_core_page('login');
34
-
35
$redirects[] = untrailingslashit( um_get_core_page('login') );
36
$redirects[] = untrailingslashit( um_get_option('access_redirect') );
37
38
$exclude_uris = um_get_option('access_exclude_uris');
39
-
40
if ( $exclude_uris ) {
41
$redirects = array_merge( $redirects, $exclude_uris );
42
}
43
44
$redirects = array_unique( $redirects );
45
-
46
$current_url = $ultimatemember->permalinks->get_current_url( get_option('permalink_structure') );
47
$current_url = untrailingslashit( $current_url );
48
$current_url_slash = trailingslashit( $current_url );
49
-
50
if ( ( isset( $post->ID ) || is_home() ) && ( in_array( $current_url, $redirects ) || in_array( $current_url_slash, $redirects ) ) ) {
51
// allow
52
} else {
53
$ultimatemember->access->redirect_handler = $redirect;
54
}
55
-
56
}
57
58
}
59
-
60
/***
61
*** @
62
***/
@@ -69,11 +69,11 @@
69
}
70
71
if ( is_single() || get_post_taxonomies( $post ) ) {
72
-
73
74
$taxonomies = get_post_taxonomies( $post );
75
$categories_ids = array();
76
-
77
foreach ($taxonomies as $key => $value) {
78
$term_list = wp_get_post_terms($post->ID, $value, array("fields" => "ids"));
79
foreach( $term_list as $term_id ){
@@ -83,43 +83,43 @@
83
84
85
foreach( $categories_ids as $term => $term_id ) {
86
-
87
$opt = get_option("category_$term_id");
88
-
89
if ( isset( $opt['_um_accessible'] ) ) {
90
switch( $opt['_um_accessible'] ) {
91
-
92
- case 0:
93
$ultimatemember->access->allow_access = true;
94
$ultimatemember->access->redirect_handler = false; // open to everyone
95
break;
96
-
97
case 1:
98
-
99
if ( is_user_logged_in() )
100
$ultimatemember->access->redirect_handler = ( isset( $opt['_um_redirect'] ) ) ? $opt['_um_redirect'] : site_url();
101
-
102
if ( !is_user_logged_in() )
103
$ultimatemember->access->allow_access = true;
104
-
105
break;
106
-
107
case 2:
108
-
109
if ( ! is_user_logged_in() )
110
$ultimatemember->access->redirect_handler = ( isset( $opt['_um_redirect'] ) && ! empty( $opt['_um_redirect'] ) ) ? $opt['_um_redirect'] : um_get_core_page('login');
111
-
112
if ( is_user_logged_in() && isset( $opt['_um_roles'] ) && !empty( $opt['_um_roles'] ) ){
113
if ( !in_array( um_user('role'), $opt['_um_roles'] ) ) {
114
-
115
if ( is_user_logged_in() )
116
$ultimatemember->access->redirect_handler = ( isset( $opt['_um_redirect'] ) ) ? $opt['_um_redirect'] : site_url();
117
-
118
if ( !is_user_logged_in() )
119
$ultimatemember->access->redirect_handler = um_get_core_page('login');
120
}
121
}
122
-
123
}
124
}
125
@@ -130,7 +130,7 @@
130
}
131
}
132
}
133
-
134
/***
135
*** @
136
***/
@@ -140,39 +140,39 @@
140
141
// woo commerce shop ID
142
if( function_exists('is_shop') && is_shop() ) {
143
-
144
$post_id = get_option('woocommerce_shop_page_id');
145
-
146
} else if ( is_archive() || is_front_page() || is_home() || is_search() || in_the_loop() ) {
147
-
148
return;
149
150
} else {
151
-
152
if ( !get_post_type() || !isset($post->ID) ) return;
153
154
}
155
156
-
157
158
if ( !isset( $post_id ) )
159
$post_id = $post->ID;
160
161
$args = $ultimatemember->access->get_meta( $post_id );
162
-
163
extract($args);
164
165
if ( !isset( $args['custom_access_settings'] ) || $args['custom_access_settings'] == 0 ) {
166
-
167
$post_id = apply_filters('um_access_control_for_parent_posts', $post_id );
168
-
169
$args = $ultimatemember->access->get_meta( $post_id );
170
extract($args);
171
172
if ( !isset( $args['custom_access_settings'] ) || $args['custom_access_settings'] == 0 ) {
173
return;
174
}
175
-
176
}
177
178
$redirect_to = null;
@@ -180,32 +180,35 @@
180
if ( !isset( $accessible ) ) return;
181
182
switch( $accessible ) {
183
-
184
- case 0:
185
$ultimatemember->access->allow_access = true;
186
$ultimatemember->access->redirect_handler = false; // open to everyone
187
188
break;
189
-
190
case 1:
191
-
192
if ( is_user_logged_in() )
193
$redirect_to = $access_redirect2;
194
-
195
if ( !is_user_logged_in() )
196
$ultimatemember->access->allow_access = true;
197
-
198
break;
199
-
200
case 2:
201
-
202
if ( !is_user_logged_in() ){
203
if ( !$access_redirect ) $access_redirect = um_get_core_page('login');
204
$redirect_to = $access_redirect;
205
}
206
207
if ( is_user_logged_in() && isset( $access_roles ) && !empty( $access_roles ) ){
208
- if ( !in_array( um_user('role'), unserialize( $access_roles ) ) ) {
209
if ( !$access_redirect ) {
210
if ( is_user_logged_in() ) {
211
$access_redirect = site_url();
@@ -216,11 +219,11 @@
216
$redirect_to = $access_redirect;
217
}
218
}
219
-
220
break;
221
-
222
}
223
-
224
if ( $redirect_to ) {
225
if ( is_feed() ) {
226
@@ -230,4 +233,4 @@
230
}
231
}
232
233
- }
6
add_action('um_access_homepage_per_role','um_access_homepage_per_role');
7
function um_access_homepage_per_role() {
8
global $ultimatemember;
9
+
10
if ( !is_user_logged_in() ) return;
11
if ( is_admin() ) return;
12
if ( um_user('default_homepage') ) return;
13
if ( !um_user('redirect_homepage') ) return;
14
+
15
if( is_front_page() ) {
16
$ultimatemember->access->redirect_handler = um_user('redirect_homepage');
17
}
18
}
19
+
20
/***
21
*** @
22
***/
23
add_action('um_access_global_settings','um_access_global_settings');
24
function um_access_global_settings() {
25
global $post, $ultimatemember;
26
+
27
$access = um_get_option('accessible');
28
+
29
if ( $access == 2 && !is_user_logged_in() ) {
30
+
31
$redirect = um_get_option('access_redirect');
32
+ if ( !$redirect )
33
$redirect = um_get_core_page('login');
34
+
35
$redirects[] = untrailingslashit( um_get_core_page('login') );
36
$redirects[] = untrailingslashit( um_get_option('access_redirect') );
37
38
$exclude_uris = um_get_option('access_exclude_uris');
39
+
40
if ( $exclude_uris ) {
41
$redirects = array_merge( $redirects, $exclude_uris );
42
}
43
44
$redirects = array_unique( $redirects );
45
+
46
$current_url = $ultimatemember->permalinks->get_current_url( get_option('permalink_structure') );
47
$current_url = untrailingslashit( $current_url );
48
$current_url_slash = trailingslashit( $current_url );
49
+
50
if ( ( isset( $post->ID ) || is_home() ) && ( in_array( $current_url, $redirects ) || in_array( $current_url_slash, $redirects ) ) ) {
51
// allow
52
} else {
53
$ultimatemember->access->redirect_handler = $redirect;
54
}
55
+
56
}
57
58
}
59
+
60
/***
61
*** @
62
***/
69
}
70
71
if ( is_single() || get_post_taxonomies( $post ) ) {
72
+
73
74
$taxonomies = get_post_taxonomies( $post );
75
$categories_ids = array();
76
+
77
foreach ($taxonomies as $key => $value) {
78
$term_list = wp_get_post_terms($post->ID, $value, array("fields" => "ids"));
79
foreach( $term_list as $term_id ){
83
84
85
foreach( $categories_ids as $term => $term_id ) {
86
+
87
$opt = get_option("category_$term_id");
88
+
89
if ( isset( $opt['_um_accessible'] ) ) {
90
switch( $opt['_um_accessible'] ) {
91
+
92
+ case 0:
93
$ultimatemember->access->allow_access = true;
94
$ultimatemember->access->redirect_handler = false; // open to everyone
95
break;
96
+
97
case 1:
98
+
99
if ( is_user_logged_in() )
100
$ultimatemember->access->redirect_handler = ( isset( $opt['_um_redirect'] ) ) ? $opt['_um_redirect'] : site_url();
101
+
102
if ( !is_user_logged_in() )
103
$ultimatemember->access->allow_access = true;
104
+
105
break;
106
+
107
case 2:
108
+
109
if ( ! is_user_logged_in() )
110
$ultimatemember->access->redirect_handler = ( isset( $opt['_um_redirect'] ) && ! empty( $opt['_um_redirect'] ) ) ? $opt['_um_redirect'] : um_get_core_page('login');
111
+
112
if ( is_user_logged_in() && isset( $opt['_um_roles'] ) && !empty( $opt['_um_roles'] ) ){
113
if ( !in_array( um_user('role'), $opt['_um_roles'] ) ) {
114
+
115
if ( is_user_logged_in() )
116
$ultimatemember->access->redirect_handler = ( isset( $opt['_um_redirect'] ) ) ? $opt['_um_redirect'] : site_url();
117
+
118
if ( !is_user_logged_in() )
119
$ultimatemember->access->redirect_handler = um_get_core_page('login');
120
}
121
}
122
+
123
}
124
}
125
130
}
131
}
132
}
133
+
134
/***
135
*** @
136
***/
140
141
// woo commerce shop ID
142
if( function_exists('is_shop') && is_shop() ) {
143
+
144
$post_id = get_option('woocommerce_shop_page_id');
145
+
146
} else if ( is_archive() || is_front_page() || is_home() || is_search() || in_the_loop() ) {
147
+
148
return;
149
150
} else {
151
+
152
if ( !get_post_type() || !isset($post->ID) ) return;
153
154
}
155
156
+
157
158
if ( !isset( $post_id ) )
159
$post_id = $post->ID;
160
161
$args = $ultimatemember->access->get_meta( $post_id );
162
+
163
extract($args);
164
165
if ( !isset( $args['custom_access_settings'] ) || $args['custom_access_settings'] == 0 ) {
166
+
167
$post_id = apply_filters('um_access_control_for_parent_posts', $post_id );
168
+
169
$args = $ultimatemember->access->get_meta( $post_id );
170
extract($args);
171
172
if ( !isset( $args['custom_access_settings'] ) || $args['custom_access_settings'] == 0 ) {
173
return;
174
}
175
+
176
}
177
178
$redirect_to = null;
180
if ( !isset( $accessible ) ) return;
181
182
switch( $accessible ) {
183
+
184
+ case 0:
185
$ultimatemember->access->allow_access = true;
186
$ultimatemember->access->redirect_handler = false; // open to everyone
187
188
break;
189
+
190
case 1:
191
+
192
if ( is_user_logged_in() )
193
$redirect_to = $access_redirect2;
194
+
195
if ( !is_user_logged_in() )
196
$ultimatemember->access->allow_access = true;
197
+
198
break;
199
+
200
case 2:
201
+
202
if ( !is_user_logged_in() ){
203
if ( !$access_redirect ) $access_redirect = um_get_core_page('login');
204
$redirect_to = $access_redirect;
205
}
206
207
if ( is_user_logged_in() && isset( $access_roles ) && !empty( $access_roles ) ){
208
+ $access_roles = unserialize( $access_roles );
209
+ $access_roles = array_filter($access_roles);
210
+
211
+ if ( !empty( $access_roles ) && !in_array( um_user('role'), $access_roles ) ) {
212
if ( !$access_redirect ) {
213
if ( is_user_logged_in() ) {
214
$access_redirect = site_url();
219
$redirect_to = $access_redirect;
220
}
221
}
222
+
223
break;
224
+
225
}
226
+
227
if ( $redirect_to ) {
228
if ( is_feed() ) {
229
233
}
234
}
235
236
+ }
core/um-actions-register.php CHANGED
@@ -114,6 +114,8 @@
114
$ultimatemember->user->set_registration_details( $args['submitted'] );
115
116
$ultimatemember->user->set_plain_password( $args['user_password'] );
117
118
do_action('um_new_user_registration_plain');
119
@@ -193,9 +195,10 @@
193
}
194
195
if ( um_user( $status . '_action' ) == 'show_message' && um_user( $status . '_message' ) != '' ) {
196
- $url = um_get_core_page('register');
197
$url = add_query_arg( 'message', esc_attr( $status ), $url );
198
$url = add_query_arg( 'uid', esc_attr( um_user('ID') ), $url );
199
exit( wp_redirect( $url ) );
200
}
201
114
$ultimatemember->user->set_registration_details( $args['submitted'] );
115
116
$ultimatemember->user->set_plain_password( $args['user_password'] );
117
+
118
+ $ultimatemember->user->set_last_login();
119
120
do_action('um_new_user_registration_plain');
121
195
}
196
197
if ( um_user( $status . '_action' ) == 'show_message' && um_user( $status . '_message' ) != '' ) {
198
+ $url = $ultimatemember->permalinks->get_current_url();
199
$url = add_query_arg( 'message', esc_attr( $status ), $url );
200
$url = add_query_arg( 'uid', esc_attr( um_user('ID') ), $url );
201
+
202
exit( wp_redirect( $url ) );
203
}
204
core/um-actions-wpadmin.php CHANGED
@@ -99,19 +99,15 @@
99
/***
100
*** @hide admin bar appropriately
101
***/
102
- function um_control_admin_bar(){
103
if ( um_user('can_not_see_adminbar') )
104
return false;
105
106
- if( !is_admin() && !um_user('can_access_wpadmin') ) {
107
- return false;
108
- } else {
109
- um_fetch_user( get_current_user_id() );
110
- return true;
111
- }
112
}
113
add_filter( 'show_admin_bar' , 'um_control_admin_bar');
114
-
115
/***
116
*** @fix permission for admin bar
117
***/
99
/***
100
*** @hide admin bar appropriately
101
***/
102
+ function um_control_admin_bar( $content ){
103
+
104
if ( um_user('can_not_see_adminbar') )
105
return false;
106
107
+ return $content;
108
}
109
add_filter( 'show_admin_bar' , 'um_control_admin_bar');
110
+
111
/***
112
*** @fix permission for admin bar
113
***/
core/um-filters-avatars.php CHANGED
@@ -28,12 +28,7 @@
28
29
$avatar = um_user('profile_photo', $size);
30
31
- if ( !um_profile('profile_photo') && um_get_option('use_gravatars') ) {
32
- if ( is_ssl() ) {
33
- $protocol = 'https://';
34
- } else {
35
- $protocol = 'http://';
36
- }
37
38
$default = get_option( 'avatar_default', 'mystery' );
39
if ( $default == 'gravatar_default' ) {
@@ -45,14 +40,18 @@
45
$rating = "&amp;r={$rating}";
46
}
47
48
- $avatar = '<img src="' . $protocol . 'gravatar.com/avatar/' . md5( um_user('user_email') ) .
49
- '?d='. $default . '&amp;s=' . $size . $rating .'" class="gravatar avatar avatar-'.$size.' um-avatar" width="'.$size.'" height="'.$size.'" alt="" />';
50
51
}else if( empty( $avatar ) ){
52
$default_avatar_uri = um_get_default_avatar_uri();
53
$avatar = '<img src="' .$default_avatar_uri .'" class="gravatar avatar avatar-'.$size.' um-avatar" width="'.$size.'" height="'.$size.'" alt="" />';
54
}
55
56
return $avatar;
57
58
- }
28
29
$avatar = um_user('profile_photo', $size);
30
31
+ if ( ! $avatar && um_get_option('use_gravatars') ) {
32
33
$default = get_option( 'avatar_default', 'mystery' );
34
if ( $default == 'gravatar_default' ) {
40
$rating = "&amp;r={$rating}";
41
}
42
43
+
44
+ $avatar_url = um_get_domain_protocol().'gravatar.com/avatar/'.um_user('synced_gravatar_hashed_id');
45
+
46
+ $avatar = '<img src="' .$avatar_url .'?d='. $default . '&amp;s=' . $size . $rating .'" class="func-um_get_avatar gravatar avatar avatar-'.$size.' um-avatar" width="'.$size.'" height="'.$size.'" alt="" />';
47
48
}else if( empty( $avatar ) ){
49
$default_avatar_uri = um_get_default_avatar_uri();
50
+
51
$avatar = '<img src="' .$default_avatar_uri .'" class="gravatar avatar avatar-'.$size.' um-avatar" width="'.$size.'" height="'.$size.'" alt="" />';
52
}
53
54
return $avatar;
55
56
+ }
57
+
core/um-filters-members.php CHANGED
@@ -126,11 +126,25 @@
126
$query_args['meta_query']['relation'] = 'AND';
127
128
// must have a profile photo
129
- if ( $has_profile_photo == 1 ) {
130
$query_args['meta_query'][] = array(
131
- 'key' => 'profile_photo',
132
- 'value' => '',
133
- 'compare' => '!='
134
);
135
}
136
@@ -143,6 +157,7 @@
143
);
144
}
145
146
// show specific usernames
147
if ( isset( $show_these_users ) && $show_these_users && is_array( $show_these_users ) ) {
148
foreach( $show_these_users as $username ) {
@@ -167,6 +182,7 @@
167
168
if ( isset( $sortby ) ) {
169
170
if ( $sortby == 'other' && $sortby_custom ) {
171
172
$query_args['meta_key'] = $sortby_custom;
@@ -223,3 +239,4 @@
223
224
return $result;
225
}
126
$query_args['meta_query']['relation'] = 'AND';
127
128
// must have a profile photo
129
+ if ( $has_profile_photo == 1 && ! um_get_option('use_gravatars') ) {
130
$query_args['meta_query'][] = array(
131
+ 'relation' => 'OR',
132
+ array(
133
+ 'key' => 'synced_profile_photo', // addons
134
+ 'value' => '',
135
+ 'compare' => '!='
136
+ ),
137
+ array(
138
+ 'key' => 'profile_photo', // from upload form
139
+ 'value' => '',
140
+ 'compare' => '!='
141
+ ),
142
+ array(
143
+ 'key' => 'synced_gravatar_hashed_id', // gravatar
144
+ 'value' => '',
145
+ 'compare' => '!='
146
+ )
147
+
148
);
149
}
150
157
);
158
}
159
160
+
161
// show specific usernames
162
if ( isset( $show_these_users ) && $show_these_users && is_array( $show_these_users ) ) {
163
foreach( $show_these_users as $username ) {
182
183
if ( isset( $sortby ) ) {
184
185
+
186
if ( $sortby == 'other' && $sortby_custom ) {
187
188
$query_args['meta_key'] = $sortby_custom;
239
240
return $result;
241
}
242
+
core/um-form.php CHANGED
@@ -82,16 +82,14 @@ class UM_Form {
82
$this->post_form = array_merge( $this->form_data, $this->post_form );
83
84
$role = $this->assigned_role( $this->form_id );
85
-
86
- if ( isset( $this->form_data['role'] ) && ( (boolean) $this->form_data['role'] ) && isset( $_POST['role'] ) && $_POST['role'] != $role ) {
87
- wp_die( __( 'This is not possible for security reasons.','ultimatemember') );
88
- } else {
89
- if ( isset( $this->form_data['custom_fields'] ) && strstr( $this->form_data['custom_fields'], 'role_' ) ) {
90
- // In this case, admin allowed users to choose a role during registration
91
} else {
92
if ( isset( $_POST['role'] ) ) {
93
if ( $role != $_POST['role'] ) {
94
- wp_die( __( 'This is not possible for security reasons.','ultimatemember') );
95
}
96
}
97
}
@@ -169,10 +167,17 @@ class UM_Form {
169
}
170
171
function assigned_role( $post_id ){
172
- $role = get_post_meta( $post_id, '_um_register_role', true );
173
174
- if( ! $role ){
175
$role = um_get_option('default_role');
176
}
177
return $role;
178
}
82
$this->post_form = array_merge( $this->form_data, $this->post_form );
83
84
$role = $this->assigned_role( $this->form_id );
85
+
86
+ if( $role && isset( $this->form_data['custom_fields'] ) && ! strstr( $this->form_data['custom_fields'], 'role_' ) ){ // has assigned role. Validate non-global forms
87
+ if ( isset( $this->form_data['role'] ) && ( (boolean) $this->form_data['role'] ) && isset( $_POST['role'] ) && $_POST['role'] != $role ) {
88
+ wp_die( __( 'This is not possible for security reasons.','ultimatemember') );
89
} else {
90
if ( isset( $_POST['role'] ) ) {
91
if ( $role != $_POST['role'] ) {
92
+ wp_die( __( 'This is not possible for security reasons.','ultimatemember') );
93
}
94
}
95
}
167
}
168
169
function assigned_role( $post_id ){
170
171
+ $register_use_globals = get_post_meta( $post_id, '_um_register_use_globals', true);
172
+
173
+ if( $register_use_globals == 1 ){
174
$role = um_get_option('default_role');
175
+ }else if( $register_use_globals == 0 ){
176
+ $role = get_post_meta( $post_id, '_um_register_role', true );
177
+ }
178
+
179
+ if( ! $role ){
180
+ $role = false;
181
}
182
return $role;
183
}
core/um-mail.php CHANGED
@@ -37,6 +37,13 @@ class UM_Mail {
37
}
38
} else {
39
$lang = get_locale();
40
}
41
42
if ( file_exists( get_stylesheet_directory() . '/ultimate-member/templates/email/' . $lang . $template . '.html' ) ) {
@@ -75,6 +82,7 @@ class UM_Mail {
75
if ( isset( $args['admin'] ) || isset( $args['plain_text'] ) ) {
76
$this->force_plain_text = 'forced';
77
}
78
79
// HTML e-mail or text
80
if ( um_get_option('email_html') && $this->email_template( $template, $args ) ) {
37
}
38
} else {
39
$lang = get_locale();
40
+
41
+ if( $lang == 'en_US' ){
42
+ $lang = '/';
43
+ }else{
44
+ $lang .= '/';
45
+ }
46
+
47
}
48
49
if ( file_exists( get_stylesheet_directory() . '/ultimate-member/templates/email/' . $lang . $template . '.html' ) ) {
82
if ( isset( $args['admin'] ) || isset( $args['plain_text'] ) ) {
83
$this->force_plain_text = 'forced';
84
}
85
+
86
87
// HTML e-mail or text
88
if ( um_get_option('email_html') && $this->email_template( $template, $args ) ) {
core/um-short-functions.php CHANGED
@@ -1163,11 +1163,12 @@ function um_fetch_user( $user_id ) {
1163
/***
1164
*** @default avatar
1165
***/
1166
- function um_get_default_avatar_uri() {
1167
$uri = um_get_option('default_avatar');
1168
$uri = $uri['url'];
1169
if ( !$uri )
1170
$uri = um_url . 'assets/img/default_avatar.jpg';
1171
return $uri;
1172
}
1173
@@ -1194,173 +1195,197 @@ function um_fetch_user( $user_id ) {
1194
return '';
1195
}
1196
1197
- function um_user( $data, $attrs = null ) {
1198
-
1199
- global $ultimatemember;
1200
1201
- switch($data){
1202
1203
- default:
1204
1205
- $value = um_profile($data);
1206
1207
- if ( $ultimatemember->validation->is_serialized( $value ) ) {
1208
- $value = unserialize( $value );
1209
- }
1210
1211
- return $value;
1212
- break;
1213
1214
- case 'full_name':
1215
1216
- if ( um_user('first_name') && um_user('last_name') ) {
1217
- $full_name = um_user('first_name') . ' ' . um_user('last_name');
1218
- } else {
1219
- $full_name = um_user('display_name');
1220
- }
1221
1222
- $full_name = $ultimatemember->validation->safe_name_in_url( $full_name );
1223
1224
- // update full_name changed
1225
- if( um_profile( $data ) !== $full_name )
1226
- {
1227
- update_user_meta( um_user('ID'), 'full_name', $full_name );
1228
- }
1229
1230
- return $full_name;
1231
1232
- break;
1233
1234
- case 'display_name':
1235
1236
- $op = um_get_option('display_name');
1237
1238
- $name = '';
1239
1240
1241
- if ( $op == 'default' ) {
1242
- $name = um_profile('display_name');
1243
- }
1244
1245
- if ( $op == 'nickname' ) {
1246
- $name = um_profile('nickname');
1247
- }
1248
1249
- if ( $op == 'full_name' ) {
1250
- if ( um_user('first_name') && um_user('last_name') ) {
1251
- $name = um_user('first_name') . ' ' . um_user('last_name');
1252
- } else {
1253
- $name = um_profile( $data );
1254
}
1255
- if ( ! $name ) {
1256
- $name = um_user('user_login');
1257
}
1258
- }
1259
1260
- if ( $op == 'sur_name' ) {
1261
- if ( um_user('first_name') && um_user('last_name') ) {
1262
- $name = um_user('last_name') . ' ' . um_user('first_name');
1263
- } else {
1264
- $name = um_profile( $data );
1265
}
1266
- }
1267
1268
- if ( $op == 'first_name' ) {
1269
- if ( um_user('first_name') ) {
1270
- $name = um_user('first_name');
1271
- } else {
1272
- $name = um_profile( $data );
1273
}
1274
- }
1275
1276
- if ( $op == 'username' ) {
1277
- $name = um_user('user_login');
1278
- }
1279
1280
- if ( $op == 'initial_name' ) {
1281
- if ( um_user('first_name') && um_user('last_name') ) {
1282
- $initial = um_user('last_name');
1283
- $name = um_user('first_name') . ' ' . $initial[0];
1284
- } else {
1285
- $name = um_profile( $data );
1286
}
1287
- }
1288
1289
- if ( $op == 'initial_name_f' ) {
1290
- if ( um_user('first_name') && um_user('last_name') ) {
1291
- $initial = um_user('first_name');
1292
- $name = $initial[0] . ' ' . um_user('last_name');
1293
- } else {
1294
- $name = um_profile( $data );
1295
}
1296
- }
1297
1298
- if ( $op == 'field' && um_get_option('display_name_field') != '' ) {
1299
- $fields = array_filter(preg_split('/[,\s]+/', um_get_option('display_name_field') ));
1300
- $name = '';
1301
- foreach( $fields as $field ) {
1302
- $name .= um_profile( $field ) . ' ';
1303
}
1304
- }
1305
1306
- return apply_filters('um_user_display_name_filter', $name, um_user('ID'), ( $attrs == 'html' ) ? 1 : 0 );
1307
1308
- break;
1309
1310
- case 'role_select':
1311
- case 'role_radio':
1312
- return $ultimatemember->user->get_role_name( um_user('role') );
1313
- break;
1314
1315
- case 'submitted':
1316
- $array = um_profile($data);
1317
- if ( empty( $array ) ) return '';
1318
- $array = unserialize( $array );
1319
- return $array;
1320
- break;
1321
1322
- case 'password_reset_link':
1323
- return $ultimatemember->password->reset_url();
1324
- break;
1325
1326
- case 'account_activation_link':
1327
- return $ultimatemember->permalinks->activate_url();
1328
- break;
1329
1330
- case 'profile_photo':
1331
1332
- if ( um_profile('profile_photo') ) {
1333
- $avatar_uri = um_get_avatar_uri( um_profile('profile_photo'), $attrs );
1334
- } else {
1335
- $avatar_uri = um_get_default_avatar_uri();
1336
- }
1337
1338
- $avatar_uri = apply_filters('um_user_avatar_url_filter', $avatar_uri, um_user('ID') );
1339
1340
- if ( $avatar_uri )
1341
- return '<img src="' . $avatar_uri . '" class="gravatar avatar avatar-'.$attrs.' um-avatar" width="'.$attrs.'" height="'.$attrs.'" alt="" />';
1342
1343
- if ( !$avatar_uri )
1344
- return '';
1345
1346
- break;
1347
1348
- case 'cover_photo':
1349
- if ( um_profile('cover_photo') ) {
1350
- $cover_uri = um_get_cover_uri( um_profile('cover_photo'), $attrs );
1351
- } else {
1352
- $cover_uri = um_get_default_cover_uri();
1353
- }
1354
1355
- if ( $cover_uri )
1356
- return '<img src="'. $cover_uri .'" alt="" />';
1357
1358
- if ( !$cover_uri )
1359
- return '';
1360
1361
- break;
1362
1363
}
1364
1365
- }
1366
1163
/***
1164
*** @default avatar
1165
***/
1166
+ function um_get_default_avatar_uri( $user_id = '' ) {
1167
$uri = um_get_option('default_avatar');
1168
$uri = $uri['url'];
1169
if ( !$uri )
1170
$uri = um_url . 'assets/img/default_avatar.jpg';
1171
+
1172
return $uri;
1173
}
1174
1195
return '';
1196
}
1197
1198
+ function um_user( $data, $attrs = null ) {
1199
1200
+ global $ultimatemember;
1201
1202
+ switch($data){
1203
1204
+ default:
1205
1206
+ $value = um_profile($data);
1207
1208
+ if ( $ultimatemember->validation->is_serialized( $value ) ) {
1209
+ $value = unserialize( $value );
1210
+ }
1211
1212
+ return $value;
1213
+ break;
1214
1215
+ case 'full_name':
1216
1217
+ if ( um_user('first_name') && um_user('last_name') ) {
1218
+ $full_name = um_user('first_name') . ' ' . um_user('last_name');
1219
+ } else {
1220
+ $full_name = um_user('display_name');
1221
+ }
1222
1223
+ $full_name = $ultimatemember->validation->safe_name_in_url( $full_name );
1224
1225
+ // update full_name changed
1226
+ if( um_profile( $data ) !== $full_name )
1227
+ {
1228
+ update_user_meta( um_user('ID'), 'full_name', $full_name );
1229
+ }
1230
1231
+ return $full_name;
1232
1233
+ break;
1234
1235
+ case 'display_name':
1236
1237
+ $op = um_get_option('display_name');
1238
1239
+ $name = '';
1240
1241
1242
+ if ( $op == 'default' ) {
1243
+ $name = um_profile('display_name');
1244
+ }
1245
1246
+ if ( $op == 'nickname' ) {
1247
+ $name = um_profile('nickname');
1248
}
1249
+
1250
+ if ( $op == 'full_name' ) {
1251
+ if ( um_user('first_name') && um_user('last_name') ) {
1252
+ $name = um_user('first_name') . ' ' . um_user('last_name');
1253
+ } else {
1254
+ $name = um_profile( $data );
1255
+ }
1256
+ if ( ! $name ) {
1257
+ $name = um_user('user_login');
1258
+ }
1259
}
1260
1261
+ if ( $op == 'sur_name' ) {
1262
+ if ( um_user('first_name') && um_user('last_name') ) {
1263
+ $name = um_user('last_name') . ' ' . um_user('first_name');
1264
+ } else {
1265
+ $name = um_profile( $data );
1266
+ }
1267
}
1268
1269
+ if ( $op == 'first_name' ) {
1270
+ if ( um_user('first_name') ) {
1271
+ $name = um_user('first_name');
1272
+ } else {
1273
+ $name = um_profile( $data );
1274
+ }
1275
}
1276
1277
+ if ( $op == 'username' ) {
1278
+ $name = um_user('user_login');
1279
+ }
1280
1281
+ if ( $op == 'initial_name' ) {
1282
+ if ( um_user('first_name') && um_user('last_name') ) {
1283
+ $initial = um_user('last_name');
1284
+ $name = um_user('first_name') . ' ' . $initial[0];
1285
+ } else {
1286
+ $name = um_profile( $data );
1287
+ }
1288
}
1289
1290
+ if ( $op == 'initial_name_f' ) {
1291
+ if ( um_user('first_name') && um_user('last_name') ) {
1292
+ $initial = um_user('first_name');
1293
+ $name = $initial[0] . ' ' . um_user('last_name');
1294
+ } else {
1295
+ $name = um_profile( $data );
1296
+ }
1297
}
1298
1299
+ if ( $op == 'field' && um_get_option('display_name_field') != '' ) {
1300
+ $fields = array_filter(preg_split('/[,\s]+/', um_get_option('display_name_field') ));
1301
+ $name = '';
1302
+ foreach( $fields as $field ) {
1303
+ $name .= um_profile( $field ) . ' ';
1304
+ }
1305
}
1306
1307
+ return apply_filters('um_user_display_name_filter', $name, um_user('ID'), ( $attrs == 'html' ) ? 1 : 0 );
1308
1309
+ break;
1310
1311
+ case 'role_select':
1312
+ case 'role_radio':
1313
+ return $ultimatemember->user->get_role_name( um_user('role') );
1314
+ break;
1315
1316
+ case 'submitted':
1317
+ $array = um_profile($data);
1318
+ if ( empty( $array ) ) return '';
1319
+ $array = unserialize( $array );
1320
+ return $array;
1321
+ break;
1322
1323
+ case 'password_reset_link':
1324
+ return $ultimatemember->password->reset_url();
1325
+ break;
1326
1327
+ case 'account_activation_link':
1328
+ return $ultimatemember->permalinks->activate_url();
1329
+ break;
1330
1331
+ case 'profile_photo':
1332
+
1333
+ $has_profile_photo = false;
1334
1335
+ if ( um_profile('profile_photo') ) {
1336
+ $avatar_uri = um_get_avatar_uri( um_profile('profile_photo'), $attrs );
1337
+ $has_profile_photo = true;
1338
+ } else {
1339
+ $avatar_uri = um_get_default_avatar_uri( um_user('ID') );
1340
+ }
1341
1342
+ $avatar_uri = apply_filters('um_user_avatar_url_filter', $avatar_uri, um_user('ID') );
1343
+
1344
+ if ( $avatar_uri )
1345
+
1346
+ if( um_get_option('use_gravatars') && ! um_user('synced_profile_photo') && ! $has_profile_photo ){
1347
+ $avatar_uri = um_get_domain_protocol().'gravatar.com/avatar/'.um_user('synced_gravatar_hashed_id');
1348
+ $avatar_uri = add_query_arg('s',400, $avatar_uri);
1349
+ }
1350
1351
+ return '<img src="' . $avatar_uri . '" class="func-um_user gravatar avatar avatar-'.$attrs.' um-avatar" width="'.$attrs.'" height="'.$attrs.'" alt="" />';
1352
1353
+ if ( !$avatar_uri )
1354
+ return '';
1355
1356
+ break;
1357
1358
+ case 'cover_photo':
1359
+ if ( um_profile('cover_photo') ) {
1360
+ $cover_uri = um_get_cover_uri( um_profile('cover_photo'), $attrs );
1361
+ } else {
1362
+ $cover_uri = um_get_default_cover_uri();
1363
+ }
1364
1365
+ if ( $cover_uri )
1366
+ return '<img src="'. $cover_uri .'" alt="" />';
1367
1368
+ if ( !$cover_uri )
1369
+ return '';
1370
1371
+ break;
1372
+
1373
+ }
1374
1375
}
1376
1377
+ /**
1378
+ * Get server protocol
1379
+ * @return string
1380
+ */
1381
+ function um_get_domain_protocol(){
1382
+
1383
+ if ( is_ssl() ) {
1384
+ $protocol = 'https://';
1385
+ } else {
1386
+ $protocol = 'http://';
1387
+ }
1388
+
1389
+ return $protocol;
1390
+ }
1391
core/um-shortcodes.php CHANGED
@@ -123,7 +123,9 @@ class UM_Shortcodes {
123
*/
124
function core_login_form() {
125
$forms = get_posts(array('post_type' => 'um_form', 'posts_per_page' => 1, 'meta_key' => '_um_core', 'meta_value' => 'login'));
126
- return $forms[0]->ID;
127
}
128
129
/***
123
*/
124
function core_login_form() {
125
$forms = get_posts(array('post_type' => 'um_form', 'posts_per_page' => 1, 'meta_key' => '_um_core', 'meta_value' => 'login'));
126
+ $form_id = isset( $forms[0]->ID ) ? $forms[0]->ID: 0;
127
+
128
+ return $form_id;
129
}
130
131
/***
core/um-user.php CHANGED
@@ -57,7 +57,7 @@ class UM_User {
57
function community_role_edit( $user ) {
58
global $ultimatemember;
59
if ( current_user_can( 'edit_users' ) && current_user_can( 'edit_user', $user->ID ) ) {
60
- $user = get_userdata( $user->ID );
61
?>
62
<table class="form-table">
63
<tbody>
@@ -346,6 +346,13 @@ class UM_User {
346
function set_plain_password( $plain ) {
347
update_user_meta( $this->id, '_um_cool_but_hard_to_guess_plain_pw', $plain );
348
}
349
350
function set_role( $role ){
351
57
function community_role_edit( $user ) {
58
global $ultimatemember;
59
if ( current_user_can( 'edit_users' ) && current_user_can( 'edit_user', $user->ID ) ) {
60
+ um_fetch_user( $user->ID );
61
?>
62
<table class="form-table">
63
<tbody>
346
function set_plain_password( $plain ) {
347
update_user_meta( $this->id, '_um_cool_but_hard_to_guess_plain_pw', $plain );
348
}
349
+
350
+ /**
351
+ * Set last login for new registered users
352
+ */
353
+ function set_last_login(){
354
+ update_user_meta( $this->id, '_um_last_login', current_time( 'timestamp' ) );
355
+ }
356
357
function set_role( $role ){
358
index.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Ultimate Member
4
Plugin URI: http://ultimatemember.com/
5
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
6
- Version: 1.3.38
7
Author: Ultimate Member
8
Author URI: http://ultimatemember.com/
9
*/
3
Plugin Name: Ultimate Member
4
Plugin URI: http://ultimatemember.com/
5
Description: The easiest way to create powerful online communities and beautiful user profiles with WordPress
6
+ Version: 1.3.39
7
Author: Ultimate Member
8
Author URI: http://ultimatemember.com/
9
*/
readme.txt CHANGED
@@ -7,7 +7,7 @@ Tags: access control, author, authors, author profile, comments, community, comm
7
Requires at least: 4.1
8
Tested up to: 4.4
9
10
- Stable Tag: 1.3.38
11
12
License: GNU Version 2 or Any Later Version
13
@@ -149,6 +149,25 @@ The plugin works with popular caching plugins by automatically excluding Ultimat
149
150
== Changelog ==
151
152
= 1.3.38: February 19, 2016 =
153
154
* Tweak: remove username validation
7
Requires at least: 4.1
8
Tested up to: 4.4
9
10
+ Stable Tag: 1.3.39
11
12
License: GNU Version 2 or Any Later Version
13
149
150
== Changelog ==
151
152
+ = 1.3.39: February 24, 2016 =
153
+
154
+ * New: add gravatar transfer tool
155
+ * New: show users with gravatar photo in member directory
156
+ * New: add upgrade class for data migration
157
+ * Tweak: Set last login for new users to show in member directory
158
+ * Tweak: validate roles for forms without fields
159
+ * Tweak: cropper js update
160
+ * Tweak: update minified script
161
+ * Tweak: tooltip and comment
162
+ * Fixed: member search query
163
+ * Fixed: Registration process with pending and show message enabled
164
+ * Fixed: Fix form security validation
165
+ * Fixed: email content type, template and localization
166
+ * Fixed: remove php notices
167
+ * Fixed: custom columns for roles
168
+ * Fixed: admin bar visibility per user role
169
+ * Fixed: community role editing
170
+
171
= 1.3.38: February 19, 2016 =
172
173
* Tweak: remove username validation
um-init.php CHANGED
@@ -13,6 +13,7 @@ class UM_API {
13
require_once um_path . 'core/um-short-functions.php';
14
15
if (is_admin()) {
16
require_once um_path . 'admin/um-admin-init.php';
17
}
18
@@ -52,6 +53,11 @@ class UM_API {
52
__('This add-on enables you to migrate your custom user photos from BuddyPress to use with Ultimate Member.', 'ultimatemember'),
53
);
54
55
}
56
57
/***
13
require_once um_path . 'core/um-short-functions.php';
14
15
if (is_admin()) {
16
+ require_once um_path . 'admin/core/um-admin-upgrade.php';
17
require_once um_path . 'admin/um-admin-init.php';
18
}
19
53
__('This add-on enables you to migrate your custom user photos from BuddyPress to use with Ultimate Member.', 'ultimatemember'),
54
);
55
56
+ $this->addons['gravatar_transfer'] = array(
57
+ __('Gravatar Transfer', 'ultimatemember'),
58
+ __('This add-on enables you to link gravatar photos to user accounts with their email address.', 'ultimatemember'),
59
+ );
60
+
61
}
62
63
/***