/*! gridster.js - v0.5.6 - 2014-09-25
* http://gridster.net/
* Copyright (c) 2014 ducksboard; Licensed MIT */
!function(i,t){"function"==typeof define&&define.amd?define("gridster-coords",["jquery"],t):i.GridsterCoords=t(i.$||i.jQuery)}(this,function(i){function t(t){return t[0]&&i.isPlainObject(t[0])?this.data=t[0]:this.el=t,this.isCoords=!0,this.coords={},this.init(),this}var e=t.prototype;return e.init=function(){this.set(),this.original_coords=this.get()},e.set=function(i,t){var e=this.el;if(e&&!i&&(this.data=e.offset(),this.data.width=e.width(),this.data.height=e.height()),e&&i&&!t){var s=e.offset();this.data.top=s.top,this.data.left=s.left}var r=this.data;return"undefined"==typeof r.left&&(r.left=r.x1),"undefined"==typeof r.top&&(r.top=r.y1),this.coords.x1=r.left,this.coords.y1=r.top,this.coords.x2=r.left+r.width,this.coords.y2=r.top+r.height,this.coords.cx=r.left+r.width/2,this.coords.cy=r.top+r.height/2,this.coords.width=r.width,this.coords.height=r.height,this.coords.el=e||!1,this},e.update=function(t){if(!t&&!this.el)return this;if(t){var e=i.extend({},this.data,t);return this.data=e,this.set(!0,!0)}return this.set(!0),this},e.get=function(){return this.coords},e.destroy=function(){this.el.removeData("coords"),delete this.el},i.fn.coords=function(){if(this.data("coords"))return this.data("coords");var i=new t(this,arguments[0]);return this.data("coords",i),i},t}),function(i,t){"function"==typeof define&&define.amd?define("gridster-collision",["jquery","gridster-coords"],t):i.GridsterCollision=t(i.$||i.jQuery,i.GridsterCoords)}(this,function(i,t){function e(t,e,r){this.options=i.extend(s,r),this.$element=t,this.last_colliders=[],this.last_colliders_coords=[],this.set_colliders(e),this.init()}var s={colliders_context:document.body,overlapping_region:"C"};e.defaults=s;var r=e.prototype;return r.init=function(){this.find_collisions()},r.overlaps=function(i,t){var e=!1,s=!1;return(t.x1>=i.x1&&t.x1<=i.x2||t.x2>=i.x1&&t.x2<=i.x2||i.x1>=t.x1&&i.x2<=t.x2)&&(e=!0),(t.y1>=i.y1&&t.y1<=i.y2||t.y2>=i.y1&&t.y2<=i.y2||i.y1>=t.y1&&i.y2<=t.y2)&&(s=!0),e&&s},r.detect_overlapping_region=function(i,t){var e="",s="";return i.y1>t.cy&&i.y1<t.y2&&(e="N"),i.y2>t.y1&&i.y2<t.cy&&(e="S"),i.x1>t.cx&&i.x1<t.x2&&(s="W"),i.x2>t.x1&&i.x2<t.cx&&(s="E"),e+s||"C"},r.calculate_overlapped_area_coords=function(t,e){var s=Math.max(t.x1,e.x1),r=Math.max(t.y1,e.y1),o=Math.min(t.x2,e.x2),a=Math.min(t.y2,e.y2);return i({left:s,top:r,width:o-s,height:a-r}).coords().get()},r.calculate_overlapped_area=function(i){return i.width*i.height},r.manage_colliders_start_stop=function(t,e,s){for(var r=this.last_colliders_coords,o=0,a=r.length;o<a;o++)i.inArray(r[o],t)===-1&&e.call(this,r[o]);for(var n=0,h=t.length;n<h;n++)i.inArray(t[n],r)===-1&&s.call(this,t[n])},r.find_collisions=function(t){for(var e=this,s=this.options.overlapping_region,r=[],o=[],a=this.colliders||this.$colliders,n=a.length,h=e.$element.coords().update(t||!1).get();n--;){var _=e.$colliders?i(a[n]):a[n],d=_.isCoords?_:_.coords(),l=d.get(),c=e.overlaps(h,l);if(c){var p=e.detect_overlapping_region(h,l);if(p===s||"all"===s){var g=e.calculate_overlapped_area_coords(h,l),u=e.calculate_overlapped_area(g),f={area:u,area_coords:g,region:p,coords:l,player_coords:h,el:_};e.options.on_overlap&&e.options.on_overlap.call(this,f),r.push(d),o.push(f)}}}return(e.options.on_overlap_stop||e.options.on_overlap_start)&&this.manage_colliders_start_stop(r,e.options.on_overlap_start,e.options.on_overlap_stop),this.last_colliders_coords=r,o},r.get_closest_colliders=function(i){var t=this.find_collisions(i);return t.sort(function(i,t){return"C"===i.region&&"C"===t.region?i.coords.y1<t.coords.y1||i.coords.x1<t.coords.x1?-1:1:(i.area<t.area,1)}),t},r.set_colliders=function(t){"string"==typeof t||t instanceof i?this.$colliders=i(t,this.options.colliders_context).not(this.$element):this.colliders=i(t)},i.fn.collision=function(i,t){return new e(this,i,t)},e}),function(i,t){/* Delay, debounce and throttle functions taken from underscore.js
     *
     * Copyright (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and
     * Investigative Reporters & Editors
     *
     * Permission is hereby granted, free of charge, to any person
     * obtaining a copy of this software and associated documentation
     * files (the "Software"), to deal in the Software without
     * restriction, including without limitation the rights to use,
     * copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the
     * Software is furnished to do so, subject to the following
     * conditions:
     *
     * The above copyright notice and this permission notice shall be
     * included in all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
     * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
     * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
     * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
     * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
     * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     * OTHER DEALINGS IN THE SOFTWARE.
     */
i.delay=function(i,t){var e=Array.prototype.slice.call(arguments,2);return setTimeout(function(){return i.apply(null,e)},t)},i.debounce=function(i,t,e){var s;return function(){var r=this,o=arguments,a=function(){s=null,e||i.apply(r,o)};e&&!s&&i.apply(r,o),clearTimeout(s),s=setTimeout(a,t)}},i.throttle=function(i,t){var e,s,r,o,a,n,h=debounce(function(){a=o=!1},t);return function(){e=this,s=arguments;var _=function(){r=null,a&&i.apply(e,s),h()};return r||(r=setTimeout(_,t)),o?a=!0:n=i.apply(e,s),h(),o=!0,n}}}(window),function(i,t){"function"==typeof define&&define.amd?define("gridster-draggable",["jquery"],t):i.GridsterDraggable=t(i.$||i.jQuery)}(this,function(i){function t(t,s){this.options=i.extend({},e,s),this.$document=i(document),this.$container=i(t),this.$dragitems=i(this.options.items,this.$container),this.is_dragging=!1,this.player_min_left=0+this.options.offset_left,this.id=h(),this.ns=".gridster-draggable-"+this.id,this.init()}var e={items:"li",distance:1,limit:!0,offset_left:0,autoscroll:!0,ignore_dragging:["INPUT","TEXTAREA","SELECT","BUTTON"],handle:null,container_width:0,move_element:!0,helper:!1,remove_helper:!0},s=i(window),r={x:"left",y:"top"},o=!!("ontouchstart"in window),a=function(i){return i.charAt(0).toUpperCase()+i.slice(1)},n=0,h=function(){return++n+""};t.defaults=e;var _=t.prototype;return _.init=function(){var t=this.$container.css("position");this.calculate_dimensions(),this.$container.css("position","static"===t?"relative":t),this.disabled=!1,this.events(),i(window).bind(this.nsEvent("resize"),throttle(i.proxy(this.calculate_dimensions,this),200))},_.nsEvent=function(i){return(i||"")+this.ns},_.events=function(){this.pointer_events={start:this.nsEvent("touchstart")+" "+this.nsEvent("mousedown"),move:this.nsEvent("touchmove")+" "+this.nsEvent("mousemove"),end:this.nsEvent("touchend")+" "+this.nsEvent("mouseup")},this.$container.on(this.nsEvent("selectstart"),i.proxy(this.on_select_start,this)),this.$container.on(this.pointer_events.start,this.options.items,i.proxy(this.drag_handler,this)),this.$document.on(this.pointer_events.end,i.proxy(function(i){this.is_dragging=!1,this.disabled||(this.$document.off(this.pointer_events.move),this.drag_start&&this.on_dragstop(i))},this))},_.get_actual_pos=function(i){var t=i.position();return t},_.get_mouse_pos=function(i){if(i.originalEvent&&i.originalEvent.touches){var t=i.originalEvent;i=t.touches.length?t.touches[0]:t.changedTouches[0]}return{left:i.clientX,top:i.clientY}},_.get_offset=function(t){t.preventDefault();var e=this.get_mouse_pos(t),s=Math.round(e.left-this.mouse_init_pos.left),r=Math.round(e.top-this.mouse_init_pos.top),o=Math.round(this.el_init_offset.left+s-this.baseX+i(window).scrollLeft()-this.win_offset_x),a=Math.round(this.el_init_offset.top+r-this.baseY+i(window).scrollTop()-this.win_offset_y);return this.options.limit&&(o>this.player_max_left?o=this.player_max_left:o<this.player_min_left&&(o=this.player_min_left)),{position:{left:o,top:a},pointer:{left:e.left,top:e.top,diff_left:s+(i(window).scrollLeft()-this.win_offset_x),diff_top:r+(i(window).scrollTop()-this.win_offset_y)}}},_.get_drag_data=function(i){var t=this.get_offset(i);return t.$player=this.$player,t.$helper=this.helper?this.$helper:this.$player,t},_.set_limits=function(i){return i||(i=this.$container.width()),this.player_max_left=i-this.player_width+-this.options.offset_left,this.options.container_width=i,this},_.scroll_in=function(t,e){var o,n=r[t],h=50,_=30,d="x"===t,l=d?this.window_width:this.window_height,c=d?i(document).width():i(document).height(),p=d?this.$player.width():this.$player.height(),g=s["scroll"+a(n)](),u=g,f=u+l,w=f-h,m=u+h,y=u+e.pointer[n],v=c-l+p;return y>=w&&(o=g+_,o<v&&(s["scroll"+a(n)](o),this["scroll_offset_"+t]+=_)),y<=m&&(o=g-_,o>0&&(s["scroll"+a(n)](o),this["scroll_offset_"+t]-=_)),this},_.manage_scroll=function(i){this.scroll_in("x",i),this.scroll_in("y",i)},_.calculate_dimensions=function(i){this.window_height=s.height(),this.window_width=s.width()},_.drag_handler=function(t){t.target.nodeName;if(!this.disabled&&(1===t.which||o)&&!this.ignore_drag(t)){var e=this,s=!0;return this.$player=i(t.currentTarget),this.el_init_pos=this.get_actual_pos(this.$player),this.mouse_init_pos=this.get_mouse_pos(t),this.offsetY=this.mouse_init_pos.top-this.el_init_pos.top,this.$document.on(this.pointer_events.move,function(i){var t=e.get_mouse_pos(i),r=Math.abs(t.left-e.mouse_init_pos.left),o=Math.abs(t.top-e.mouse_init_pos.top);return(r>e.options.distance||o>e.options.distance)&&(s?(s=!1,e.on_dragstart.call(e,i),!1):(e.is_dragging===!0&&e.on_dragmove.call(e,i),!1))}),!!o&&void 0}},_.on_dragstart=function(t){if(t.preventDefault(),this.is_dragging)return this;this.drag_start=this.is_dragging=!0;var e=this.$container.offset();return this.baseX=Math.round(e.left),this.baseY=Math.round(e.top),this.initial_container_width=this.options.container_width||this.$container.width(),"clone"===this.options.helper?(this.$helper=this.$player.clone().appendTo(this.$container).addClass("helper"),this.helper=!0):this.helper=!1,this.win_offset_y=i(window).scrollTop(),this.win_offset_x=i(window).scrollLeft(),this.scroll_offset_y=0,this.scroll_offset_x=0,this.el_init_offset=this.$player.offset(),this.player_width=this.$player.width(),this.player_height=this.$player.height(),this.set_limits(this.options.container_width),this.options.start&&this.options.start.call(this.$player,t,this.get_drag_data(t)),!1},_.on_dragmove=function(i){var t=this.get_drag_data(i);this.options.autoscroll&&this.manage_scroll(t),this.options.move_element&&(this.helper?this.$helper:this.$player).css({position:"absolute",left:t.position.left,top:t.position.top});var e=this.last_position||t.position;return t.prev_position=e,this.options.drag&&this.options.drag.call(this.$player,i,t),this.last_position=t.position,!1},_.on_dragstop=function(i){var t=this.get_drag_data(i);return this.drag_start=!1,this.options.stop&&this.options.stop.call(this.$player,i,t),this.helper&&this.options.remove_helper&&this.$helper.remove(),!1},_.on_select_start=function(i){if(!this.disabled&&!this.ignore_drag(i))return!1},_.enable=function(){this.disabled=!1},_.disable=function(){this.disabled=!0},_.destroy=function(){this.disable(),this.$container.off(this.ns),this.$document.off(this.ns),i(window).off(this.ns),i.removeData(this.$container,"drag")},_.ignore_drag=function(t){return this.options.handle?!i(t.target).is(this.options.handle):i.isFunction(this.options.ignore_dragging)?this.options.ignore_dragging(t):i(t.target).is(this.options.ignore_dragging.join(", "))},i.fn.drag=function(i){return new t(this,i)},t}),function(i,t){"function"==typeof define&&define.amd?define(["jquery","gridster-draggable","gridster-collision"],t):i.Gridster=t(i.$||i.jQuery,i.GridsterDraggable,i.GridsterCollision)}(this,function(i,t,e){function s(t,e){this.options=i.extend(!0,{},r,e),this.$el=i(t),this.$wrapper=this.$el.parent(),this.$widgets=this.$el.children(this.options.widget_selector).addClass("gs-w"),this.widgets=[],this.$changed=i([]),this.wrapper_width=this.$wrapper.width(),this.min_widget_width=2*this.options.widget_margins[0]+this.options.widget_base_dimensions[0],this.min_widget_height=2*this.options.widget_margins[1]+this.options.widget_base_dimensions[1],this.generated_stylesheets=[],this.$style_tags=i([]),this.options.auto_init&&this.init()}var r={namespace:"",widget_selector:"li",widget_margins:[10,10],widget_base_dimensions:[400,225],extra_rows:0,extra_cols:0,min_cols:1,max_cols:1/0,min_rows:15,max_size_x:!1,autogrow_cols:!1,autogenerate_stylesheet:!0,avoid_overlapped_widgets:!0,auto_init:!0,serialize_params:function(i,t){return{col:t.col,row:t.row,size_x:t.size_x,size_y:t.size_y}},collision:{},draggable:{items:".gs-w",distance:4,ignore_dragging:t.defaults.ignore_dragging.slice(0)},resize:{enabled:!1,axes:["both"],handle_append_to:"",handle_class:"gs-resize-handle",max_size:[1/0,1/0],min_size:[1,1]}};s.defaults=r,s.generated_stylesheets=[],s.sort_by_row_asc=function(t){return t=t.sort(function(t,e){return t.row||(t=i(t).coords().grid,e=i(e).coords().grid),t.row>e.row?1:-1})},s.sort_by_row_and_col_asc=function(i){return i=i.sort(function(i,t){return i.row>t.row||i.row===t.row&&i.col>t.col?1:-1})},s.sort_by_col_asc=function(i){return i=i.sort(function(i,t){return i.col>t.col?1:-1})},s.sort_by_row_desc=function(i){return i=i.sort(function(i,t){return i.row+i.size_y<t.row+t.size_y?1:-1})};var o=s.prototype;return o.init=function(){this.options.resize.enabled&&this.setup_resize(),this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this.set_dom_grid_width(),this.$wrapper.addClass("ready"),this.draggable(),this.options.resize.enabled&&this.resizable(),i(window).bind("resize.gridster",throttle(i.proxy(this.recalculate_faux_grid,this),200))},o.disable=function(){return this.$wrapper.find(".player-revert").removeClass("player-revert"),this.drag_api.disable(),this},o.enable=function(){return this.drag_api.enable(),this},o.disable_resize=function(){return this.$el.addClass("gs-resize-disabled"),this.resize_api.disable(),this},o.enable_resize=function(){return this.$el.removeClass("gs-resize-disabled"),this.resize_api.enable(),this},o.add_widget=function(t,e,s,r,o,a,n){var h;e||(e=1),s||(s=1),!r&!o?h=this.next_position(e,s):(h={col:r,row:o,size_x:e,size_y:s},this.empty_cells(r,o,e,s));var _=i(t).attr({"data-col":h.col,"data-row":h.row,"data-sizex":e,"data-sizey":s}).addClass("gs-w").appendTo(this.$el).hide();return this.$widgets=this.$widgets.add(_),this.register_widget(_),this.add_faux_rows(h.size_y),a&&this.set_widget_max_size(_,a),n&&this.set_widget_min_size(_,n),this.set_dom_grid_width(),this.set_dom_grid_height(),this.drag_api.set_limits(this.cols*this.min_widget_width),_.fadeIn()},o.set_widget_min_size=function(i,t){if(i="number"==typeof i?this.$widgets.eq(i):i,!i.length)return this;var e=i.data("coords").grid;return e.min_size_x=t[0],e.min_size_y=t[1],this},o.set_widget_max_size=function(i,t){if(i="number"==typeof i?this.$widgets.eq(i):i,!i.length)return this;var e=i.data("coords").grid;return e.max_size_x=t[0],e.max_size_y=t[1],this},o.add_resize_handle=function(t){var e=this.options.resize.handle_append_to;return i(this.resize_handle_tpl).appendTo(e?i(e,t):t),this},o.resize_widget=function(i,t,e,s){var r=i.coords().grid,o=r.col,a=this.options.max_cols,n=r.size_y,h=r.col,_=h;t||(t=r.size_x),e||(e=r.size_y),a!==1/0&&(t=Math.min(t,a-o+1)),e>n&&this.add_faux_rows(Math.max(e-n,0));var d=o+t-1;d>this.cols&&this.add_faux_cols(d-this.cols);var l={col:_,row:r.row,size_x:t,size_y:e};return this.mutate_widget_in_gridmap(i,r,l),this.set_dom_grid_height(),this.set_dom_grid_width(),s&&s.call(this,l.size_x,l.size_y),i},o.mutate_widget_in_gridmap=function(t,e,s){var r=(e.size_x,e.size_y),o=this.get_cells_occupied(e),a=this.get_cells_occupied(s),n=[];i.each(o.cols,function(t,e){i.inArray(e,a.cols)===-1&&n.push(e)});var h=[];i.each(a.cols,function(t,e){i.inArray(e,o.cols)===-1&&h.push(e)});var _=[];i.each(o.rows,function(t,e){i.inArray(e,a.rows)===-1&&_.push(e)});var d=[];if(i.each(a.rows,function(t,e){i.inArray(e,o.rows)===-1&&d.push(e)}),this.remove_from_gridmap(e),h.length){var l=[s.col,s.row,s.size_x,Math.min(r,s.size_y),t];this.empty_cells.apply(this,l)}if(d.length){var c=[s.col,s.row,s.size_x,s.size_y,t];this.empty_cells.apply(this,c)}if(e.col=s.col,e.row=s.row,e.size_x=s.size_x,e.size_y=s.size_y,this.add_to_gridmap(s,t),t.removeClass("player-revert"),t.data("coords").update({width:s.size_x*this.options.widget_base_dimensions[0]+(s.size_x-1)*this.options.widget_margins[0]*2,height:s.size_y*this.options.widget_base_dimensions[1]+(s.size_y-1)*this.options.widget_margins[1]*2}),t.attr({"data-col":s.col,"data-row":s.row,"data-sizex":s.size_x,"data-sizey":s.size_y}),n.length){var p=[n[0],s.row,n.length,Math.min(r,s.size_y),t];this.remove_empty_cells.apply(this,p)}if(_.length){var g=[s.col,s.row,s.size_x,s.size_y,t];this.remove_empty_cells.apply(this,g)}return this.move_widget_up(t),this},o.empty_cells=function(t,e,s,r,o){var a=this.widgets_below({col:t,row:e-r,size_x:s,size_y:r});return a.not(o).each(i.proxy(function(t,s){var o=i(s).coords().grid;if(o.row<=e+r-1){var a=e+r-o.row;this.move_widget_down(i(s),a)}},this)),this.set_dom_grid_height(),this},o.remove_empty_cells=function(t,e,s,r,o){var a=this.widgets_below({col:t,row:e,size_x:s,size_y:r});return a.not(o).each(i.proxy(function(t,e){this.move_widget_up(i(e),r)},this)),this.set_dom_grid_height(),this},o.next_position=function(i,t){i||(i=1),t||(t=1);for(var e,r=this.gridmap,o=r.length,a=[],n=1;n<o;n++){e=r[n].length;for(var h=1;h<=e;h++){var _=this.can_move_to({size_x:i,size_y:t},n,h);_&&a.push({col:n,row:h,size_y:t,size_x:i})}}return!!a.length&&s.sort_by_row_and_col_asc(a)[0]},o.remove_widget=function(t,e,s){var r=t instanceof i?t:i(t),o=r.coords().grid;i.isFunction(e)&&(s=e,e=!1),this.cells_occupied_by_placeholder={},this.$widgets=this.$widgets.not(r);var a=this.widgets_below(r);return this.remove_from_gridmap(o),r.fadeOut(i.proxy(function(){r.remove(),e||a.each(i.proxy(function(t,e){this.move_widget_up(i(e),o.size_y)},this)),this.set_dom_grid_height(),s&&s.call(this,t)},this)),this},o.remove_all_widgets=function(t){return this.$widgets.each(i.proxy(function(i,e){this.remove_widget(e,!0,t)},this)),this},o.serialize=function(t){return t||(t=this.$widgets),t.map(i.proxy(function(t,e){var s=i(e);return this.options.serialize_params(s,s.coords().grid)},this)).get()},o.serialize_changed=function(){return this.serialize(this.$changed)},o.dom_to_coords=function(i){return{col:parseInt(i.attr("data-col"),10),row:parseInt(i.attr("data-row"),10),size_x:parseInt(i.attr("data-sizex"),10)||1,size_y:parseInt(i.attr("data-sizey"),10)||1,max_size_x:parseInt(i.attr("data-max-sizex"),10)||!1,max_size_y:parseInt(i.attr("data-max-sizey"),10)||!1,min_size_x:parseInt(i.attr("data-min-sizex"),10)||!1,min_size_y:parseInt(i.attr("data-min-sizey"),10)||!1,el:i}},o.register_widget=function(t){var e=t instanceof jQuery,s=e?this.dom_to_coords(t):t,r=!1;e||(t=s.el);var o=this.can_go_widget_up(s);return o&&(s.row=o,t.attr("data-row",o),this.$el.trigger("gridster:positionchanged",[s]),r=!0),this.options.avoid_overlapped_widgets&&!this.can_move_to({size_x:s.size_x,size_y:s.size_y},s.col,s.row)&&(i.extend(s,this.next_position(s.size_x,s.size_y)),t.attr({"data-col":s.col,"data-row":s.row,"data-sizex":s.size_x,"data-sizey":s.size_y}),r=!0),t.data("coords",t.coords()),t.data("coords").grid=s,this.add_to_gridmap(s,t),this.options.resize.enabled&&this.add_resize_handle(t),r},o.update_widget_position=function(i,t){return this.for_each_cell_occupied(i,function(i,e){return this.gridmap[i]?void(this.gridmap[i][e]=t):this}),this},o.remove_from_gridmap=function(i){return this.update_widget_position(i,!1)},o.add_to_gridmap=function(t,e){if(this.update_widget_position(t,e||t.el),t.el){var s=this.widgets_below(t.el);s.each(i.proxy(function(t,e){this.move_widget_up(i(e))},this))}},o.draggable=function(){var t=this,e=i.extend(!0,{},this.options.draggable,{offset_left:this.options.widget_margins[0],offset_top:this.options.widget_margins[1],container_width:this.cols*this.min_widget_width,limit:!0,start:function(e,s){t.$widgets.filter(".player-revert").removeClass("player-revert"),t.$player=i(this),t.$helper=i(s.$helper),t.helper=!t.$helper.is(t.$player),t.on_start_drag.call(t,e,s),t.$el.trigger("gridster:dragstart")},stop:function(i,e){t.on_stop_drag.call(t,i,e),t.$el.trigger("gridster:dragstop")},drag:throttle(function(i,e){t.on_drag.call(t,i,e),t.$el.trigger("gridster:drag")},60)});return this.drag_api=this.$el.drag(e),this},o.resizable=function(){return this.resize_api=this.$el.drag({items:"."+this.options.resize.handle_class,offset_left:this.options.widget_margins[0],container_width:this.container_width,move_element:!1,resize:!0,limit:!this.options.autogrow_cols,start:i.proxy(this.on_start_resize,this),stop:i.proxy(function(t,e){delay(i.proxy(function(){this.on_stop_resize(t,e)},this),120)},this),drag:throttle(i.proxy(this.on_resize,this),60)}),this},o.setup_resize=function(){this.resize_handle_class=this.options.resize.handle_class;var t=this.options.resize.axes,e='<span class="'+this.resize_handle_class+" "+this.resize_handle_class+'-{type}" />';return this.resize_handle_tpl=i.map(t,function(i){return e.replace("{type}",i)}).join(""),i.isArray(this.options.draggable.ignore_dragging)&&this.options.draggable.ignore_dragging.push("."+this.resize_handle_class),this},o.on_start_drag=function(t,e){this.$helper.add(this.$player).add(this.$wrapper).addClass("gs-dragging"),this.highest_col=this.get_highest_occupied_cell().col,this.$player.addClass("player"),this.player_grid_data=this.$player.coords().grid,this.placeholder_grid_data=i.extend({},this.player_grid_data),this.set_dom_grid_height(this.$el.height()+this.player_grid_data.size_y*this.min_widget_height),this.set_dom_grid_width(this.cols);var s=this.player_grid_data.size_x,r=this.cols-this.highest_col;this.options.autogrow_cols&&r<=s&&this.add_faux_cols(Math.min(s-r,1));var o=this.faux_grid,a=this.$player.data("coords").coords;this.cells_occupied_by_player=this.get_cells_occupied(this.player_grid_data),this.cells_occupied_by_placeholder=this.get_cells_occupied(this.placeholder_grid_data),this.last_cols=[],this.last_rows=[],this.collision_api=this.$helper.collision(o,this.options.collision),this.$preview_holder=i("<"+this.$player.get(0).tagName+" />",{"class":"preview-holder","data-row":this.$player.attr("data-row"),"data-col":this.$player.attr("data-col"),css:{width:a.width,height:a.height}}).appendTo(this.$el),this.options.draggable.start&&this.options.draggable.start.call(this,t,e)},o.on_drag=function(i,t){if(null===this.$player)return!1;var e={left:t.position.left+this.baseX,top:t.position.top+this.baseY};if(this.options.autogrow_cols){var s=this.placeholder_grid_data.col+this.placeholder_grid_data.size_x-1;s>=this.cols-1&&this.options.max_cols>=this.cols+1&&(this.add_faux_cols(1),this.set_dom_grid_width(this.cols+1),this.drag_api.set_limits(this.container_width)),this.collision_api.set_colliders(this.faux_grid)}this.colliders_data=this.collision_api.get_closest_colliders(e),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.helper&&this.$player&&this.$player.css({left:t.position.left,top:t.position.top}),this.options.draggable.drag&&this.options.draggable.drag.call(this,i,t)},o.on_stop_drag=function(i,t){this.$helper.add(this.$player).add(this.$wrapper).removeClass("gs-dragging"),t.position.left=t.position.left+this.baseX,t.position.top=t.position.top+this.baseY,this.colliders_data=this.collision_api.get_closest_colliders(t.position),this.on_overlapped_column_change(this.on_start_overlapping_column,this.on_stop_overlapping_column),this.on_overlapped_row_change(this.on_start_overlapping_row,this.on_stop_overlapping_row),this.$player.addClass("player-revert").removeClass("player").attr({"data-col":this.placeholder_grid_data.col,"data-row":this.placeholder_grid_data.row}).css({left:"",top:""}),this.$changed=this.$changed.add(this.$player),this.cells_occupied_by_player=this.get_cells_occupied(this.placeholder_grid_data),this.set_cells_player_occupies(this.placeholder_grid_data.col,this.placeholder_grid_data.row),this.$player.coords().grid.row=this.placeholder_grid_data.row,this.$player.coords().grid.col=this.placeholder_grid_data.col,this.options.draggable.stop&&this.options.draggable.stop.call(this,i,t),this.$preview_holder.remove(),this.$player=null,this.$helper=null,this.placeholder_grid_data={},this.player_grid_data={},this.cells_occupied_by_placeholder={},this.cells_occupied_by_player={},this.set_dom_grid_height(),this.set_dom_grid_width(),this.options.autogrow_cols&&this.drag_api.set_limits(this.cols*this.min_widget_width)},o.on_start_resize=function(t,e){this.$resized_widget=e.$player.closest(".gs-w"),this.resize_coords=this.$resized_widget.coords(),this.resize_wgd=this.resize_coords.grid,this.resize_initial_width=this.resize_coords.coords.width,this.resize_initial_height=this.resize_coords.coords.height,this.resize_initial_sizex=this.resize_coords.grid.size_x,this.resize_initial_sizey=this.resize_coords.grid.size_y,this.resize_initial_col=this.resize_coords.grid.col,this.resize_last_sizex=this.resize_initial_sizex,this.resize_last_sizey=this.resize_initial_sizey,this.resize_max_size_x=Math.min(this.resize_wgd.max_size_x||this.options.resize.max_size[0],this.options.max_cols-this.resize_initial_col+1),this.resize_max_size_y=this.resize_wgd.max_size_y||this.options.resize.max_size[1],this.resize_min_size_x=this.resize_wgd.min_size_x||this.options.resize.min_size[0]||1,this.resize_min_size_y=this.resize_wgd.min_size_y||this.options.resize.min_size[1]||1,this.resize_initial_last_col=this.get_highest_occupied_cell().col,this.set_dom_grid_width(this.cols),this.resize_dir={right:e.$player.is("."+this.resize_handle_class+"-x"),bottom:e.$player.is("."+this.resize_handle_class+"-y")},this.$resized_widget.css({"min-width":this.options.widget_base_dimensions[0],"min-height":this.options.widget_base_dimensions[1]});var s=this.$resized_widget.get(0).tagName;this.$resize_preview_holder=i("<"+s+" />",{"class":"preview-holder resize-preview-holder","data-row":this.$resized_widget.attr("data-row"),"data-col":this.$resized_widget.attr("data-col"),css:{width:this.resize_initial_width,height:this.resize_initial_height}}).appendTo(this.$el),this.$resized_widget.addClass("resizing"),this.options.resize.start&&this.options.resize.start.call(this,t,e,this.$resized_widget),this.$el.trigger("gridster:resizestart")},o.on_stop_resize=function(t,e){this.$resized_widget.removeClass("resizing").css({width:"",height:""}),delay(i.proxy(function(){this.$resize_preview_holder.remove().css({"min-width":"","min-height":""}),this.options.resize.stop&&this.options.resize.stop.call(this,t,e,this.$resized_widget),this.$el.trigger("gridster:resizestop")},this),300),this.set_dom_grid_width(),this.options.autogrow_cols&&this.drag_api.set_limits(this.cols*this.min_widget_width)},o.on_resize=function(i,t){var e,s=t.pointer.diff_left,r=t.pointer.diff_top,o=this.options.widget_base_dimensions[0],a=this.options.widget_base_dimensions[1],n=this.options.widget_margins[0],h=this.options.widget_margins[1],_=this.resize_max_size_x,d=this.resize_min_size_x,l=this.resize_max_size_y,c=this.resize_min_size_y,p=this.options.autogrow_cols,g=1/0,u=1/0,f=Math.ceil(s/(o+2*n)-.2),w=Math.ceil(r/(a+2*h)-.2),m=Math.max(1,this.resize_initial_sizex+f),y=Math.max(1,this.resize_initial_sizey+w),v=this.container_width/this.min_widget_width-this.resize_initial_col+1,z=v*this.min_widget_width-2*n;if(m=Math.max(Math.min(m,_),d),m=Math.min(v,m),e=_*o+(m-1)*n*2,g=Math.min(e,z),min_width=d*o+(m-1)*n*2,y=Math.max(Math.min(y,l),c),u=l*a+(y-1)*h*2,min_height=c*a+(y-1)*h*2,this.resize_dir.right?y=this.resize_initial_sizey:this.resize_dir.bottom&&(m=this.resize_initial_sizex),p){var x=this.resize_initial_col+m-1;p&&this.resize_initial_last_col<=x&&(this.set_dom_grid_width(Math.max(x+1,this.cols)),this.cols<x&&this.add_faux_cols(x-this.cols))}var $={};!this.resize_dir.bottom&&($.width=Math.max(Math.min(this.resize_initial_width+s,g),min_width)),!this.resize_dir.right&&($.height=Math.max(Math.min(this.resize_initial_height+r,u),min_height)),this.$resized_widget.css($),m===this.resize_last_sizex&&y===this.resize_last_sizey||(this.resize_widget(this.$resized_widget,m,y),this.set_dom_grid_width(this.cols),this.$resize_preview_holder.css({width:"",height:""}).attr({"data-row":this.$resized_widget.attr("data-row"),"data-sizex":m,"data-sizey":y})),this.options.resize.resize&&this.options.resize.resize.call(this,i,t,this.$resized_widget),this.$el.trigger("gridster:resize"),this.resize_last_sizex=m,this.resize_last_sizey=y},o.on_overlapped_column_change=function(t,e){if(!this.colliders_data.length)return this;var s,r=this.get_targeted_columns(this.colliders_data[0].el.data.col),o=this.last_cols.length,a=r.length;for(s=0;s<a;s++)i.inArray(r[s],this.last_cols)===-1&&(t||i.noop).call(this,r[s]);for(s=0;s<o;s++)i.inArray(this.last_cols[s],r)===-1&&(e||i.noop).call(this,this.last_cols[s]);return this.last_cols=r,this},o.on_overlapped_row_change=function(t,e){if(!this.colliders_data.length)return this;var s,r=this.get_targeted_rows(this.colliders_data[0].el.data.row),o=this.last_rows.length,a=r.length;for(s=0;s<a;s++)i.inArray(r[s],this.last_rows)===-1&&(t||i.noop).call(this,r[s]);for(s=0;s<o;s++)i.inArray(this.last_rows[s],r)===-1&&(e||i.noop).call(this,this.last_rows[s]);this.last_rows=r},o.set_player=function(i,t,e){var s=this;e||this.empty_cells_player_occupies();var r=e?{col:i}:s.colliders_data[0].el.data,o=r.col,a=t||r.row;this.player_grid_data={col:o,row:a,size_y:this.player_grid_data.size_y,size_x:this.player_grid_data.size_x},this.cells_occupied_by_player=this.get_cells_occupied(this.player_grid_data);var n=this.get_widgets_overlapped(this.player_grid_data),h=this.widgets_constraints(n);if(this.manage_movements(h.can_go_up,o,a),this.manage_movements(h.can_not_go_up,o,a),!n.length){var _=this.can_go_player_up(this.player_grid_data);_!==!1&&(a=_),this.set_placeholder(o,a)}return{col:o,row:a}},o.widgets_constraints=function(t){var e,r=i([]),o=[],a=[];return t.each(i.proxy(function(t,e){var s=i(e),n=s.coords().grid;this.can_go_widget_up(n)?(r=r.add(s),o.push(n)):a.push(n)},this)),e=t.not(r),{can_go_up:s.sort_by_row_asc(o),can_not_go_up:s.sort_by_row_desc(a)}},o.manage_movements=function(t,e,s){return i.each(t,i.proxy(function(i,t){var r=t,o=r.el,a=this.can_go_widget_up(r);if(a)this.move_widget_to(o,a),this.set_placeholder(e,a+r.size_y);else{var n=this.can_go_player_up(this.player_grid_data);if(!n){var h=s+this.player_grid_data.size_y-r.row;this.move_widget_down(o,h),this.set_placeholder(e,s)}}},this)),this},o.is_player=function(i,t){if(t&&!this.gridmap[i])return!1;var e=t?this.gridmap[i][t]:i;return e&&(e.is(this.$player)||e.is(this.$helper))},o.is_player_in=function(t,e){var s=this.cells_occupied_by_player||{};return i.inArray(t,s.cols)>=0&&i.inArray(e,s.rows)>=0},o.is_placeholder_in=function(t,e){var s=this.cells_occupied_by_placeholder||{};return this.is_placeholder_in_col(t)&&i.inArray(e,s.rows)>=0},o.is_placeholder_in_col=function(t){var e=this.cells_occupied_by_placeholder||[];return i.inArray(t,e.cols)>=0},o.is_empty=function(i,t){return"undefined"==typeof this.gridmap[i]||"undefined"!=typeof this.gridmap[i][t]&&this.gridmap[i][t]===!1},o.is_occupied=function(i,t){return!!this.gridmap[i]&&!!this.gridmap[i][t]},o.is_widget=function(i,t){var e=this.gridmap[i];return!!e&&(e=e[t],!!e&&e)},o.is_widget_under_player=function(i,t){return!!this.is_widget(i,t)&&this.is_player_in(i,t)},o.get_widgets_under_player=function(t){t||(t=this.cells_occupied_by_player||{cols:[],rows:[]});var e=i([]);return i.each(t.cols,i.proxy(function(s,r){i.each(t.rows,i.proxy(function(i,t){this.is_widget(r,t)&&(e=e.add(this.gridmap[r][t]))},this))},this)),e},o.set_placeholder=function(t,e){var s=i.extend({},this.placeholder_grid_data),r=this.widgets_below({col:s.col,row:s.row,size_y:s.size_y,size_x:s.size_x}),o=t+s.size_x-1;o>this.cols&&(t-=o-t);var a=this.placeholder_grid_data.row<e,n=this.placeholder_grid_data.col!==t;this.placeholder_grid_data.col=t,this.placeholder_grid_data.row=e,this.cells_occupied_by_placeholder=this.get_cells_occupied(this.placeholder_grid_data),this.$preview_holder.attr({"data-row":e,"data-col":t}),(a||n)&&r.each(i.proxy(function(e,r){this.move_widget_up(i(r),this.placeholder_grid_data.col-t+s.size_y)},this));var h=this.get_widgets_under_player(this.cells_occupied_by_placeholder);h.length&&h.each(i.proxy(function(t,r){var o=i(r);this.move_widget_down(o,e+s.size_y-o.data("coords").grid.row)},this))},o.can_go_player_up=function(i){var t=i.row+i.size_y-1,e=!0,s=[],r=1e4,o=this.get_widgets_under_player();return this.for_each_column_occupied(i,function(i){var a=this.gridmap[i],n=t+1;for(s[i]=[];--n>0&&(this.is_empty(i,n)||this.is_player(i,n)||this.is_widget(i,n)&&a[n].is(o));)s[i].push(n),r=n<r?n:r;return 0===s[i].length?(e=!1,!0):void s[i].sort(function(i,t){return i-t})}),!!e&&this.get_valid_rows(i,s,r)},o.can_go_widget_up=function(i){var t=i.row+i.size_y-1,e=!0,s=[],r=1e4;return this.for_each_column_occupied(i,function(o){var a=this.gridmap[o];s[o]=[];for(var n=t+1;--n>0&&(!this.is_widget(o,n)||this.is_player_in(o,n)||a[n].is(i.el));)this.is_player(o,n)||this.is_placeholder_in(o,n)||this.is_player_in(o,n)||s[o].push(n),n<r&&(r=n);return 0===s[o].length?(e=!1,!0):void s[o].sort(function(i,t){return i-t})}),!!e&&this.get_valid_rows(i,s,r)},o.get_valid_rows=function(t,e,s){for(var r=t.row,o=t.row+t.size_y-1,a=t.size_y,n=s-1,h=[];++n<=o;){var _=!0;if(i.each(e,function(t,e){i.isArray(e)&&i.inArray(n,e)===-1&&(_=!1)}),_===!0&&(h.push(n),h.length===a))break}var d=!1;return 1===a?h[0]!==r&&(d=h[0]||!1):h[0]!==r&&(d=this.get_consecutive_numbers_index(h,a)),d},o.get_consecutive_numbers_index=function(i,t){for(var e=i.length,s=[],r=!0,o=-1,a=0;a<e;a++){if(r||i[a]===o+1){if(s.push(a),s.length===t)break;r=!1}else s=[],r=!0;o=i[a]}return s.length>=t&&i[s[0]]},o.get_widgets_overlapped=function(){var t=i([]),e=[],s=this.cells_occupied_by_player.rows.slice(0);return s.reverse(),i.each(this.cells_occupied_by_player.cols,i.proxy(function(r,o){i.each(s,i.proxy(function(s,r){if(!this.gridmap[o])return!0;var a=this.gridmap[o][r];this.is_occupied(o,r)&&!this.is_player(a)&&i.inArray(a,e)===-1&&(t=t.add(a),e.push(a))},this))},this)),t},o.on_start_overlapping_column=function(i){this.set_player(i,!1)},o.on_start_overlapping_row=function(i){this.set_player(!1,i)},o.on_stop_overlapping_column=function(i){this.set_player(i,!1);var t=this;this.for_each_widget_below(i,this.cells_occupied_by_player.rows[0],function(i,e){t.move_widget_up(this,t.player_grid_data.size_y)})},o.on_stop_overlapping_row=function(i){this.set_player(!1,i);for(var t=this,e=this.cells_occupied_by_player.cols,s=0,r=e.length;s<r;s++)this.for_each_widget_below(e[s],i,function(i,e){t.move_widget_up(this,t.player_grid_data.size_y)})},o.move_widget_to=function(t,e){var s=this,r=t.coords().grid,o=(e-r.row,this.widgets_below(t)),a=this.can_move_to(r,r.col,e,t);return a!==!1&&(this.remove_from_gridmap(r),r.row=e,this.add_to_gridmap(r),t.attr("data-row",e),this.$changed=this.$changed.add(t),o.each(function(t,e){var r=i(e),o=r.coords().grid,a=s.can_go_widget_up(o);a&&a!==o.row&&s.move_widget_to(r,a)}),this)},o.move_widget_up=function(t,e){var s=t.coords().grid,r=s.row,o=[];return e||(e=1),!!this.can_go_up(t)&&void this.for_each_column_occupied(s,function(s){if(i.inArray(t,o)===-1){var a=t.coords().grid,n=r-e;if(n=this.can_go_up_to_row(a,s,n),!n)return!0;var h=this.widgets_below(t);this.remove_from_gridmap(a),a.row=n,this.add_to_gridmap(a),t.attr("data-row",a.row),this.$changed=this.$changed.add(t),o.push(t),h.each(i.proxy(function(t,s){this.move_widget_up(i(s),e)},this))}})},o.move_widget_down=function(t,e){var s,r,o,a;if(e<=0)return!1;if(s=t.coords().grid,r=s.row,o=[],a=e,!t)return!1;if(i.inArray(t,o)===-1){var n=t.coords().grid,h=r+e,_=this.widgets_below(t);this.remove_from_gridmap(n),_.each(i.proxy(function(t,e){var s=i(e),r=s.coords().grid,o=this.displacement_diff(r,n,a);o>0&&this.move_widget_down(s,o)},this)),n.row=h,this.update_widget_position(n,t),t.attr("data-row",n.row),this.$changed=this.$changed.add(t),o.push(t)}},o.can_go_up_to_row=function(t,e,s){var r,o=this.gridmap,a=!0,n=[],h=t.row;if(this.for_each_column_occupied(t,function(i){o[i];for(n[i]=[],r=h;r--&&this.is_empty(i,r)&&!this.is_placeholder_in(i,r);)n[i].push(r);if(!n[i].length)return a=!1,!0}),!a)return!1;for(r=s,r=1;r<h;r++){for(var _=!0,d=0,l=n.length;d<l;d++)n[d]&&i.inArray(r,n[d])===-1&&(_=!1);if(_===!0){a=r;break}}return a},o.displacement_diff=function(i,t,e){var s=i.row,r=[],o=t.row+t.size_y;this.for_each_column_occupied(i,function(i){for(var t=0,e=o;e<s;e++)this.is_empty(i,e)&&(t+=1);
r.push(t)});var a=Math.max.apply(Math,r);return e-=a,e>0?e:0},o.widgets_below=function(t){var e=i.isPlainObject(t)?t:t.coords().grid,r=this,o=(this.gridmap,e.row+e.size_y-1),a=i([]);return this.for_each_column_occupied(e,function(t){r.for_each_widget_below(t,o,function(t,e){if(!r.is_player(this)&&i.inArray(this,a)===-1)return a=a.add(this),!0})}),s.sort_by_row_asc(a)},o.set_cells_player_occupies=function(i,t){return this.remove_from_gridmap(this.placeholder_grid_data),this.placeholder_grid_data.col=i,this.placeholder_grid_data.row=t,this.add_to_gridmap(this.placeholder_grid_data,this.$player),this},o.empty_cells_player_occupies=function(){return this.remove_from_gridmap(this.placeholder_grid_data),this},o.can_go_up=function(i){var t=i.coords().grid,e=t.row,s=e-1,r=(this.gridmap,!0);return 1!==e&&(this.for_each_column_occupied(t,function(i){this.is_widget(i,s);if(this.is_occupied(i,s)||this.is_player(i,s)||this.is_placeholder_in(i,s)||this.is_player_in(i,s))return r=!1,!0}),r)},o.can_move_to=function(i,t,e,s){var r=(this.gridmap,i.el),o={size_y:i.size_y,size_x:i.size_x,col:t,row:e},a=!0,n=t+i.size_x-1;return!(n>this.cols)&&(!(s&&s<e+i.size_y-1)&&(this.for_each_cell_occupied(o,function(t,e){var s=this.is_widget(t,e);!s||i.el&&!s.is(r)||(a=!1)}),a))},o.get_targeted_columns=function(i){for(var t=(i||this.player_grid_data.col)+(this.player_grid_data.size_x-1),e=[],s=i;s<=t;s++)e.push(s);return e},o.get_targeted_rows=function(i){for(var t=(i||this.player_grid_data.row)+(this.player_grid_data.size_y-1),e=[],s=i;s<=t;s++)e.push(s);return e},o.get_cells_occupied=function(t){var e,s={cols:[],rows:[]};for(arguments[1]instanceof i&&(t=arguments[1].coords().grid),e=0;e<t.size_x;e++){var r=t.col+e;s.cols.push(r)}for(e=0;e<t.size_y;e++){var o=t.row+e;s.rows.push(o)}return s},o.for_each_cell_occupied=function(i,t){return this.for_each_column_occupied(i,function(e){this.for_each_row_occupied(i,function(i){t.call(this,e,i)})}),this},o.for_each_column_occupied=function(i,t){for(var e=0;e<i.size_x;e++){var s=i.col+e;t.call(this,s,i)}},o.for_each_row_occupied=function(i,t){for(var e=0;e<i.size_y;e++){var s=i.row+e;t.call(this,s,i)}},o._traversing_widgets=function(t,e,s,r,o){var a=this.gridmap;if(a[s]){var n,h,_=t+"/"+e;if(arguments[2]instanceof i){var d=arguments[2].coords().grid;s=d.col,r=d.row,o=arguments[3]}var l=[],c=r,p={"for_each/above":function(){for(;c--&&!(c>0&&this.is_widget(s,c)&&i.inArray(a[s][c],l)===-1&&(n=o.call(a[s][c],s,c),l.push(a[s][c]),n)););},"for_each/below":function(){for(c=r+1,h=a[s].length;c<h&&(!this.is_widget(s,c)||i.inArray(a[s][c],l)!==-1||(n=o.call(a[s][c],s,c),l.push(a[s][c]),!n));c++);}};p[_]&&p[_].call(this)}},o.for_each_widget_above=function(i,t,e){return this._traversing_widgets("for_each","above",i,t,e),this},o.for_each_widget_below=function(i,t,e){return this._traversing_widgets("for_each","below",i,t,e),this},o.get_highest_occupied_cell=function(){for(var i,t=this.gridmap,e=t[1].length,s=[],r=[],o=t.length-1;o>=1;o--)for(i=e-1;i>=1;i--)if(this.is_widget(o,i)){s.push(i),r.push(o);break}return{col:Math.max.apply(Math,r),row:Math.max.apply(Math,s)}},o.get_widgets_from=function(t,e){var s=(this.gridmap,i());return t&&(s=s.add(this.$widgets.filter(function(){var e=i(this).attr("data-col");return e===t||e>t}))),e&&(s=s.add(this.$widgets.filter(function(){var t=i(this).attr("data-row");return t===e||t>e}))),s},o.set_dom_grid_height=function(i){if("undefined"==typeof i){var t=this.get_highest_occupied_cell().row;i=t*this.min_widget_height}return this.container_height=i,this.$el.css("height",this.container_height),this},o.set_dom_grid_width=function(i){"undefined"==typeof i&&(i=this.get_highest_occupied_cell().col);var t=this.options.autogrow_cols?this.options.max_cols:this.cols;return i=Math.min(t,Math.max(i,this.options.min_cols)),this.container_width=i*this.min_widget_width,this.$el.css("width",this.container_width),this},o.generate_stylesheet=function(t){var e,r="",o=this.options.max_size_x||this.cols;t||(t={}),t.cols||(t.cols=this.cols),t.rows||(t.rows=this.rows),t.namespace||(t.namespace=this.options.namespace),t.widget_base_dimensions||(t.widget_base_dimensions=this.options.widget_base_dimensions),t.widget_margins||(t.widget_margins=this.options.widget_margins),t.min_widget_width=2*t.widget_margins[0]+t.widget_base_dimensions[0],t.min_widget_height=2*t.widget_margins[1]+t.widget_base_dimensions[1];var a=i.param(t);if(i.inArray(a,s.generated_stylesheets)>=0)return!1;for(this.generated_stylesheets.push(a),s.generated_stylesheets.push(a),e=t.cols;e>=0;e--)r+=t.namespace+' [data-col="'+(e+1)+'"] { left:'+(e*t.widget_base_dimensions[0]+e*t.widget_margins[0]+(e+1)*t.widget_margins[0])+"px; }\n";for(e=t.rows;e>=0;e--)r+=t.namespace+' [data-row="'+(e+1)+'"] { top:'+(e*t.widget_base_dimensions[1]+e*t.widget_margins[1]+(e+1)*t.widget_margins[1])+"px; }\n";for(var n=1;n<=t.rows;n++)r+=t.namespace+' [data-sizey="'+n+'"] { height:'+(n*t.widget_base_dimensions[1]+(n-1)*(2*t.widget_margins[1]))+"px; }\n";for(var h=1;h<=o;h++)r+=t.namespace+' [data-sizex="'+h+'"] { width:'+(h*t.widget_base_dimensions[0]+(h-1)*(2*t.widget_margins[0]))+"px; }\n";return this.remove_style_tags(),this.add_style_tag(r)},o.add_style_tag=function(i){var t=document,e=t.createElement("style");return t.getElementsByTagName("head")[0].appendChild(e),e.setAttribute("type","text/css"),e.styleSheet?e.styleSheet.cssText=i:e.appendChild(document.createTextNode(i)),this.$style_tags=this.$style_tags.add(e),this},o.remove_style_tags=function(){var t=s.generated_stylesheets,e=this.generated_stylesheets;this.$style_tags.remove(),s.generated_stylesheets=i.map(t,function(t){if(i.inArray(t,e)===-1)return t})},o.generate_faux_grid=function(i,t){this.faux_grid=[],this.gridmap=[];var e,s;for(e=t;e>0;e--)for(this.gridmap[e]=[],s=i;s>0;s--)this.add_faux_cell(s,e);return this},o.add_faux_cell=function(t,e){var s=i({left:this.baseX+(e-1)*this.min_widget_width,top:this.baseY+(t-1)*this.min_widget_height,width:this.min_widget_width,height:this.min_widget_height,col:e,row:t,original_col:e,original_row:t}).coords();return i.isArray(this.gridmap[e])||(this.gridmap[e]=[]),this.gridmap[e][t]=!1,this.faux_grid.push(s),this},o.add_faux_rows=function(i){for(var t=this.rows,e=t+(i||1),s=e;s>t;s--)for(var r=this.cols;r>=1;r--)this.add_faux_cell(s,r);return this.rows=e,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this},o.add_faux_cols=function(i){var t=this.cols,e=t+(i||1);e=Math.min(e,this.options.max_cols);for(var s=t+1;s<=e;s++)for(var r=this.rows;r>=1;r--)this.add_faux_cell(r,s);return this.cols=e,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this},o.recalculate_faux_grid=function(){var t=this.$wrapper.width();return this.baseX=(i(window).width()-t)/2,this.baseY=this.$wrapper.offset().top,i.each(this.faux_grid,i.proxy(function(i,t){this.faux_grid[i]=t.update({left:this.baseX+(t.data.col-1)*this.min_widget_width,top:this.baseY+(t.data.row-1)*this.min_widget_height})},this)),this},o.get_widgets_from_DOM=function(){var t=this.$widgets.map(i.proxy(function(t,e){var s=i(e);return this.dom_to_coords(s)},this));t=s.sort_by_row_and_col_asc(t);var e=i(t).map(i.proxy(function(i,t){return this.register_widget(t)||null},this));return e.length&&this.$el.trigger("gridster:positionschanged"),this},o.generate_grid_and_stylesheet=function(){var t=this.$wrapper.width(),e=this.options.max_cols,s=Math.floor(t/this.min_widget_width)+this.options.extra_cols,r=this.$widgets.map(function(){return i(this).attr("data-col")}).get();r.length||(r=[0]);var o=Math.max.apply(Math,r);this.cols=Math.max(o,s,this.options.min_cols),e!==1/0&&e>=o&&e<this.cols&&(this.cols=e);var a=this.options.extra_rows;return this.$widgets.each(function(t,e){a+=+i(e).attr("data-sizey")}),this.rows=Math.max(a,this.options.min_rows),this.baseX=(i(window).width()-t)/2,this.baseY=this.$wrapper.offset().top,this.options.autogenerate_stylesheet&&this.generate_stylesheet(),this.generate_faux_grid(this.rows,this.cols)},o.destroy=function(t){return this.$el.removeData("gridster"),i(window).unbind(".gridster"),this.drag_api&&this.drag_api.destroy(),this.remove_style_tags(),t&&this.$el.remove(),this},i.fn.gridster=function(t){return this.each(function(){i(this).data("gridster")||i(this).data("gridster",new s(this,t))})},o.resize_widget_dimensions=function(t,e){t.widget_margins&&(this.options.widget_margins=t.widget_margins),t.widget_base_dimensions&&(this.options.widget_base_dimensions=t.widget_base_dimensions),t.max_cols&&(this.options.max_cols=t.max_cols),this.min_widget_width=2*this.options.widget_margins[0]+this.options.widget_base_dimensions[0],this.min_widget_height=2*this.options.widget_margins[1]+this.options.widget_base_dimensions[1];this.serialize();return this.$widgets.each(i.proxy(function(t,e){var s=i(e);this.resize_widget(s)},this)),this.generate_grid_and_stylesheet(),this.get_widgets_from_DOM(),this.set_dom_grid_height(),this},s});
// Spectrum Colorpicker v1.8.0
// https://github.com/bgrins/spectrum
// Author: Brian Grinstead
// License: MIT
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports&&"object"==typeof module?module.exports=t(require("jquery")):t(jQuery)}(function(t,e){"use strict";function r(e,r,a,n){for(var o=[],i=0;i<e.length;i++){var s=e[i];if(s){var l=tinycolor(s),c=l.toHsl().l<.5?"sp-thumb-el sp-thumb-dark":"sp-thumb-el sp-thumb-light";c+=tinycolor.equals(r,s)?" sp-thumb-active":"";var f=l.toString(n.preferredFormat||"rgb"),u=b?"background-color:"+l.toRgbString():"filter:"+l.toFilter();o.push('<span title="'+f+'" data-color="'+l.toRgbString()+'" class="'+c+'"><span class="sp-thumb-inner" style="'+u+';" /></span>')}else{var h="sp-clear-display";o.push(t("<div />").append(t('<span data-color="" style="background-color:transparent;" class="'+h+'"></span>').attr("title",n.noColorSelectedText)).html())}}return"<div class='sp-cf "+a+"'>"+o.join("")+"</div>"}function a(){for(var t=0;t<p.length;t++)p[t]&&p[t].hide()}function n(e,r){var a=t.extend({},d,e);return a.callbacks={move:c(a.move,r),change:c(a.change,r),show:c(a.show,r),hide:c(a.hide,r),beforeShow:c(a.beforeShow,r)},a}function o(o,s){function c(){if(W.showPaletteOnly&&(W.showPalette=!0),Dt.text(W.showPaletteOnly?W.togglePaletteMoreText:W.togglePaletteLessText),W.palette){dt=W.palette.slice(0),pt=t.isArray(dt[0])?dt:[dt],gt={};for(var e=0;e<pt.length;e++)for(var r=0;r<pt[e].length;r++){var a=tinycolor(pt[e][r]).toRgbString();gt[a]=!0}}kt.toggleClass("sp-flat",X),kt.toggleClass("sp-input-disabled",!W.showInput),kt.toggleClass("sp-alpha-enabled",W.showAlpha),kt.toggleClass("sp-clear-enabled",Qt),kt.toggleClass("sp-buttons-disabled",!W.showButtons),kt.toggleClass("sp-palette-buttons-disabled",!W.togglePaletteOnly),kt.toggleClass("sp-palette-disabled",!W.showPalette),kt.toggleClass("sp-palette-only",W.showPaletteOnly),kt.toggleClass("sp-initial-disabled",!W.showInitial),kt.addClass(W.className).addClass(W.containerClassName),z()}function d(){function e(e){return e.data&&e.data.ignore?(O(t(e.target).closest(".sp-thumb-el").data("color")),j()):(O(t(e.target).closest(".sp-thumb-el").data("color")),j(),W.hideAfterPaletteSelect?(I(!0),F()):I()),!1}if(g&&kt.find("*:not(input)").attr("unselectable","on"),c(),Bt&&_t.after(Lt).hide(),Qt||jt.hide(),X)_t.after(kt).hide();else{var r="parent"===W.appendTo?_t.parent():t(W.appendTo);1!==r.length&&(r=t("body")),r.append(kt)}y(),Kt.on("click.spectrum touchstart.spectrum",function(e){xt||A(),e.stopPropagation(),t(e.target).is("input")||e.preventDefault()}),(_t.is(":disabled")||W.disabled===!0)&&V(),kt.click(l),Tt.change(P),Tt.on("paste",function(){setTimeout(P,1)}),Tt.keydown(function(t){13==t.keyCode&&P()}),Nt.text(W.cancelText),Nt.on("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),T(),F()}),jt.attr("title",W.clearText),jt.on("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),Gt=!0,j(),X&&I(!0)}),Et.text(W.chooseText),Et.on("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),g&&Tt.is(":focus")&&Tt.trigger("change"),N()&&(I(!0),F())}),Dt.text(W.showPaletteOnly?W.togglePaletteMoreText:W.togglePaletteLessText),Dt.on("click.spectrum",function(t){t.stopPropagation(),t.preventDefault(),W.showPaletteOnly=!W.showPaletteOnly,W.showPaletteOnly||X||kt.css("left","-="+(St.outerWidth(!0)+5)),c()}),f(Ht,function(t,e,r){ht=t/it,Gt=!1,r.shiftKey&&(ht=Math.round(10*ht)/10),j()},S,C),f(At,function(t,e){ct=parseFloat(e/nt),Gt=!1,W.showAlpha||(ht=1),j()},S,C),f(Ct,function(t,e,r){if(r.shiftKey){if(!yt){var a=ft*et,n=rt-ut*rt,o=Math.abs(t-a)>Math.abs(e-n);yt=o?"x":"y"}}else yt=null;var i=!yt||"x"===yt,s=!yt||"y"===yt;i&&(ft=parseFloat(t/et)),s&&(ut=parseFloat((rt-e)/rt)),Gt=!1,W.showAlpha||(ht=1),j()},S,C),$t?(O($t),E(),Xt=W.preferredFormat||tinycolor($t).format,w($t)):E(),X&&M();var a=g?"mousedown.spectrum":"click.spectrum touchstart.spectrum";Ot.on(a,".sp-thumb-el",e),qt.on(a,".sp-thumb-el:nth-child(1)",{ignore:!0},e)}function y(){if(G&&window.localStorage){try{var e=window.localStorage[G].split(",#");e.length>1&&(delete window.localStorage[G],t.each(e,function(t,e){w(e)}))}catch(r){}try{bt=window.localStorage[G].split(";")}catch(r){}}}function w(e){if(Y){var r=tinycolor(e).toRgbString();if(!gt[r]&&t.inArray(r,bt)===-1)for(bt.push(r);bt.length>vt;)bt.shift();if(G&&window.localStorage)try{window.localStorage[G]=bt.join(";")}catch(a){}}}function _(){var t=[];if(W.showPalette)for(var e=0;e<bt.length;e++){var r=tinycolor(bt[e]).toRgbString();gt[r]||t.push(bt[e])}return t.reverse().slice(0,W.maxSelectionSize)}function x(){var e=q(),a=t.map(pt,function(t,a){return r(t,e,"sp-palette-row sp-palette-row-"+a,W)});y(),bt&&a.push(r(_(),e,"sp-palette-row sp-palette-row-selection",W)),Ot.html(a.join(""))}function k(){if(W.showInitial){var t=Wt,e=q();qt.html(r([t,e],e,"sp-palette-row-initial",W))}}function S(){(rt<=0||et<=0||nt<=0)&&z(),tt=!0,kt.addClass(mt),yt=null,_t.trigger("dragstart.spectrum",[q()])}function C(){tt=!1,kt.removeClass(mt),_t.trigger("dragstop.spectrum",[q()])}function P(){var t=Tt.val();if(null!==t&&""!==t||!Qt){var e=tinycolor(t);e.isValid()?(O(e),j(),I()):Tt.addClass("sp-validation-error")}else O(null),j(),I()}function A(){Z?F():M()}function M(){var e=t.Event("beforeShow.spectrum");return Z?void z():(_t.trigger(e,[q()]),void(J.beforeShow(q())===!1||e.isDefaultPrevented()||(a(),Z=!0,t(wt).on("keydown.spectrum",R),t(wt).on("click.spectrum",H),t(window).on("resize.spectrum",U),Lt.addClass("sp-active"),kt.removeClass("sp-hidden"),z(),E(),Wt=q(),k(),J.show(Wt),_t.trigger("show.spectrum",[Wt]))))}function R(t){27===t.keyCode&&F()}function H(t){2!=t.button&&(tt||(Yt?I(!0):T(),F()))}function F(){Z&&!X&&(Z=!1,t(wt).off("keydown.spectrum",R),t(wt).off("click.spectrum",H),t(window).off("resize.spectrum",U),Lt.removeClass("sp-active"),kt.addClass("sp-hidden"),J.hide(q()),_t.trigger("hide.spectrum",[q()]))}function T(){O(Wt,!0),I(!0)}function O(t,e){if(tinycolor.equals(t,q()))return void E();var r,a;!t&&Qt?Gt=!0:(Gt=!1,r=tinycolor(t),a=r.toHsv(),ct=a.h%360/360,ft=a.s,ut=a.v,ht=a.a),E(),r&&r.isValid()&&!e&&(Xt=W.preferredFormat||r.getFormat())}function q(t){return t=t||{},Qt&&Gt?null:tinycolor.fromRatio({h:ct,s:ft,v:ut,a:Math.round(1e3*ht)/1e3},{format:t.format||Xt})}function N(){return!Tt.hasClass("sp-validation-error")}function j(){E(),J.move(q()),_t.trigger("move.spectrum",[q()])}function E(){Tt.removeClass("sp-validation-error"),D();var t=tinycolor.fromRatio({h:ct,s:1,v:1});Ct.css("background-color",t.toHexString());var e=Xt;ht<1&&(0!==ht||"name"!==e)&&("hex"!==e&&"hex3"!==e&&"hex6"!==e&&"name"!==e||(e="rgb"));var r=q({format:e}),a="";if(Vt.removeClass("sp-clear-display"),Vt.css("background-color","transparent"),!r&&Qt)Vt.addClass("sp-clear-display");else{var n=r.toHexString(),o=r.toRgbString();if(b||1===r.alpha?Vt.css("background-color",o):(Vt.css("background-color","transparent"),Vt.css("filter",r.toFilter())),W.showAlpha){var i=r.toRgb();i.a=0;var s=tinycolor(i).toRgbString(),l="linear-gradient(left, "+s+", "+n+")";g?Rt.css("filter",tinycolor(s).toFilter({gradientType:1},n)):(Rt.css("background","-webkit-"+l),Rt.css("background","-moz-"+l),Rt.css("background","-ms-"+l),Rt.css("background","linear-gradient(to right, "+s+", "+n+")"))}a=r.toString(e)}W.showInput&&Tt.val(a),W.showPalette&&x(),k()}function D(){var t=ft,e=ut;if(Qt&&Gt)Ft.hide(),Mt.hide(),Pt.hide();else{Ft.show(),Mt.show(),Pt.show();var r=t*et,a=rt-e*rt;r=Math.max(-at,Math.min(et-at,r-at)),a=Math.max(-at,Math.min(rt-at,a-at)),Pt.css({top:a+"px",left:r+"px"});var n=ht*it;Ft.css({left:n-st/2+"px"});var o=ct*nt;Mt.css({top:o-lt+"px"})}}function I(t){var e=q(),r="",a=!tinycolor.equals(e,Wt);e&&(r=e.toString(Xt),w(e)),It&&_t.val(r),t&&a&&(J.change(e),_t.trigger("change",[e]))}function z(){Z&&(et=Ct.width(),rt=Ct.height(),at=Pt.height(),ot=At.width(),nt=At.height(),lt=Mt.height(),it=Ht.width(),st=Ft.width(),X||(kt.css("position","absolute"),W.offset?kt.offset(W.offset):kt.offset(i(kt,Kt))),D(),W.showPalette&&x(),_t.trigger("reflow.spectrum"))}function B(){_t.show(),Kt.off("click.spectrum touchstart.spectrum"),kt.remove(),Lt.remove(),p[Jt.id]=null}function L(r,a){return r===e?t.extend({},W):a===e?W[r]:(W[r]=a,"preferredFormat"===r&&(Xt=W.preferredFormat),void c())}function K(){xt=!1,_t.attr("disabled",!1),Kt.removeClass("sp-disabled")}function V(){F(),xt=!0,_t.attr("disabled",!0),Kt.addClass("sp-disabled")}function $(t){W.offset=t,z()}var W=n(s,o),X=W.flat,Y=W.showSelectionPalette,G=W.localStorageKey,Q=W.theme,J=W.callbacks,U=u(z,10),Z=!1,tt=!1,et=0,rt=0,at=0,nt=0,ot=0,it=0,st=0,lt=0,ct=0,ft=0,ut=0,ht=1,dt=[],pt=[],gt={},bt=W.selectionPalette.slice(0),vt=W.maxSelectionSize,mt="sp-dragging",yt=null,wt=o.ownerDocument,_t=(wt.body,t(o)),xt=!1,kt=t(m,wt).addClass(Q),St=kt.find(".sp-picker-container"),Ct=kt.find(".sp-color"),Pt=kt.find(".sp-dragger"),At=kt.find(".sp-hue"),Mt=kt.find(".sp-slider"),Rt=kt.find(".sp-alpha-inner"),Ht=kt.find(".sp-alpha"),Ft=kt.find(".sp-alpha-handle"),Tt=kt.find(".sp-input"),Ot=kt.find(".sp-palette"),qt=kt.find(".sp-initial"),Nt=kt.find(".sp-cancel"),jt=kt.find(".sp-clear"),Et=kt.find(".sp-choose"),Dt=kt.find(".sp-palette-toggle"),It=_t.is("input"),zt=It&&"color"===_t.attr("type")&&h(),Bt=It&&!X,Lt=Bt?t(v).addClass(Q).addClass(W.className).addClass(W.replacerClassName):t([]),Kt=Bt?Lt:_t,Vt=Lt.find(".sp-preview-inner"),$t=W.color||It&&_t.val(),Wt=!1,Xt=W.preferredFormat,Yt=!W.showButtons||W.clickoutFiresChange,Gt=!$t,Qt=W.allowEmpty&&!zt;d();var Jt={show:M,hide:F,toggle:A,reflow:z,option:L,enable:K,disable:V,offset:$,set:function(t){O(t),I()},get:q,destroy:B,container:kt};return Jt.id=p.push(Jt)-1,Jt}function i(e,r){var a=0,n=e.outerWidth(),o=e.outerHeight(),i=r.outerHeight(),s=e[0].ownerDocument,l=s.documentElement,c=l.clientWidth+t(s).scrollLeft(),f=l.clientHeight+t(s).scrollTop(),u=r.offset(),h=u.left,d=u.top;return d+=i,h-=Math.min(h,h+n>c&&c>n?Math.abs(h+n-c):0),d-=Math.min(d,d+o>f&&f>o?Math.abs(o+i-a):a),{top:d,bottom:u.bottom,left:h,right:u.right,width:u.width,height:u.height}}function s(){}function l(t){t.stopPropagation()}function c(t,e){var r=Array.prototype.slice,a=r.call(arguments,2);return function(){return t.apply(e,a.concat(r.call(arguments)))}}function f(e,r,a,n){function o(t){t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.returnValue=!1}function i(t){if(f){if(g&&c.documentMode<9&&!t.button)return l();var a=t.originalEvent&&t.originalEvent.touches&&t.originalEvent.touches[0],n=a&&a.pageX||t.pageX,i=a&&a.pageY||t.pageY,s=Math.max(0,Math.min(n-u.left,d)),b=Math.max(0,Math.min(i-u.top,h));p&&o(t),r.apply(e,[s,b,t])}}function s(r){var n=r.which?3==r.which:2==r.button;n||f||a.apply(e,arguments)!==!1&&(f=!0,h=t(e).height(),d=t(e).width(),u=t(e).offset(),t(c).on(b),t(c.body).addClass("sp-dragging"),i(r),o(r))}function l(){f&&(t(c).off(b),t(c.body).removeClass("sp-dragging"),setTimeout(function(){n.apply(e,arguments)},0)),f=!1}r=r||function(){},a=a||function(){},n=n||function(){};var c=document,f=!1,u={},h=0,d=0,p="ontouchstart"in window,b={};b.selectstart=o,b.dragstart=o,b["touchmove mousemove"]=i,b["touchend mouseup"]=l,t(e).on("touchstart mousedown",s)}function u(t,e,r){var a;return function(){var n=this,o=arguments,i=function(){a=null,t.apply(n,o)};r&&clearTimeout(a),!r&&a||(a=setTimeout(i,e))}}function h(){return t.fn.spectrum.inputTypeColorSupport()}var d={beforeShow:s,move:s,change:s,show:s,hide:s,color:!1,flat:!1,showInput:!1,allowEmpty:!1,showButtons:!0,clickoutFiresChange:!0,showInitial:!1,showPalette:!1,showPaletteOnly:!1,hideAfterPaletteSelect:!1,togglePaletteOnly:!1,showSelectionPalette:!0,localStorageKey:!1,appendTo:"body",maxSelectionSize:7,cancelText:"cancel",chooseText:"choose",togglePaletteMoreText:"more",togglePaletteLessText:"less",clearText:"Clear Color Selection",noColorSelectedText:"No Color Selected",preferredFormat:!1,className:"",containerClassName:"",replacerClassName:"",showAlpha:!1,theme:"sp-light",palette:[["#ffffff","#000000","#ff0000","#ff8000","#ffff00","#008000","#0000ff","#4b0082","#9400d3"]],selectionPalette:[],disabled:!1,offset:null},p=[],g=!!/msie/i.exec(window.navigator.userAgent),b=function(){function t(t,e){return!!~(""+t).indexOf(e)}var e=document.createElement("div"),r=e.style;return r.cssText="background-color:rgba(0,0,0,.5)",t(r.backgroundColor,"rgba")||t(r.backgroundColor,"hsla")}(),v=["<div class='sp-replacer'>","<div class='sp-preview'><div class='sp-preview-inner'></div></div>","<div class='sp-dd'>&#9660;</div>","</div>"].join(""),m=function(){var t="";if(g)for(var e=1;e<=6;e++)t+="<div class='sp-"+e+"'></div>";return["<div class='sp-container sp-hidden'>","<div class='sp-palette-container'>","<div class='sp-palette sp-thumb sp-cf'></div>","<div class='sp-palette-button-container sp-cf'>","<button type='button' class='sp-palette-toggle'></button>","</div>","</div>","<div class='sp-picker-container'>","<div class='sp-top sp-cf'>","<div class='sp-fill'></div>","<div class='sp-top-inner'>","<div class='sp-color'>","<div class='sp-sat'>","<div class='sp-val'>","<div class='sp-dragger'></div>","</div>","</div>","</div>","<div class='sp-clear sp-clear-display'>","</div>","<div class='sp-hue'>","<div class='sp-slider'></div>",t,"</div>","</div>","<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>","</div>","<div class='sp-input-container sp-cf'>","<input class='sp-input' type='text' spellcheck='false'  />","</div>","<div class='sp-initial sp-thumb sp-cf'></div>","<div class='sp-button-container sp-cf'>","<a class='sp-cancel' href='#'></a>","<button type='button' class='sp-choose'></button>","</div>","</div>","</div>"].join("")}(),y="spectrum.id";t.fn.spectrum=function(e,r){if("string"==typeof e){var a=this,n=Array.prototype.slice.call(arguments,1);return this.each(function(){var r=p[t(this).data(y)];if(r){var o=r[e];if(!o)throw new Error("Spectrum: no such method: '"+e+"'");"get"==e?a=r.get():"container"==e?a=r.container:"option"==e?a=r.option.apply(r,n):"destroy"==e?(r.destroy(),t(this).removeData(y)):o.apply(r,n)}}),a}return this.spectrum("destroy").each(function(){var r=t.extend({},t(this).data(),e),a=o(this,r);t(this).data(y,a.id)})},t.fn.spectrum.load=!0,t.fn.spectrum.loadOpts={},t.fn.spectrum.draggable=f,t.fn.spectrum.defaults=d,t.fn.spectrum.inputTypeColorSupport=function w(){if("undefined"==typeof w._cachedResult){var e=t("<input type='color'/>")[0];w._cachedResult="color"===e.type&&""!==e.value}return w._cachedResult},t.spectrum={},t.spectrum.localization={},t.spectrum.palettes={},t.fn.spectrum.processNativeColorInputs=function(){var e=t("input[type=color]");e.length&&!h()&&e.spectrum({preferredFormat:"hex6"})},
// Brian Grinstead, MIT License
function(){function t(t){var r={r:0,g:0,b:0},n=1,i=!1,s=!1;return"string"==typeof t&&(t=T(t)),"object"==typeof t&&(t.hasOwnProperty("r")&&t.hasOwnProperty("g")&&t.hasOwnProperty("b")?(r=e(t.r,t.g,t.b),i=!0,s="%"===String(t.r).substr(-1)?"prgb":"rgb"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("v")?(t.s=R(t.s),t.v=R(t.v),r=o(t.h,t.s,t.v),i=!0,s="hsv"):t.hasOwnProperty("h")&&t.hasOwnProperty("s")&&t.hasOwnProperty("l")&&(t.s=R(t.s),t.l=R(t.l),r=a(t.h,t.s,t.l),i=!0,s="hsl"),t.hasOwnProperty("a")&&(n=t.a)),n=x(n),{ok:i,format:t.format||s,r:D(255,I(r.r,0)),g:D(255,I(r.g,0)),b:D(255,I(r.b,0)),a:n}}function e(t,e,r){return{r:255*k(t,255),g:255*k(e,255),b:255*k(r,255)}}function r(t,e,r){t=k(t,255),e=k(e,255),r=k(r,255);var a,n,o=I(t,e,r),i=D(t,e,r),s=(o+i)/2;if(o==i)a=n=0;else{var l=o-i;switch(n=s>.5?l/(2-o-i):l/(o+i),o){case t:a=(e-r)/l+(e<r?6:0);break;case e:a=(r-t)/l+2;break;case r:a=(t-e)/l+4}a/=6}return{h:a,s:n,l:s}}function a(t,e,r){function a(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}var n,o,i;if(t=k(t,360),e=k(e,100),r=k(r,100),0===e)n=o=i=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;n=a(l,s,t+1/3),o=a(l,s,t),i=a(l,s,t-1/3)}return{r:255*n,g:255*o,b:255*i}}function n(t,e,r){t=k(t,255),e=k(e,255),r=k(r,255);var a,n,o=I(t,e,r),i=D(t,e,r),s=o,l=o-i;if(n=0===o?0:l/o,o==i)a=0;else{switch(o){case t:a=(e-r)/l+(e<r?6:0);break;case e:a=(r-t)/l+2;break;case r:a=(t-e)/l+4}a/=6}return{h:a,s:n,v:s}}function o(t,e,r){t=6*k(t,360),e=k(e,100),r=k(r,100);var a=j.floor(t),n=t-a,o=r*(1-e),i=r*(1-n*e),s=r*(1-(1-n)*e),l=a%6,c=[r,i,o,o,s,r][l],f=[s,r,r,i,o,o][l],u=[o,o,s,r,r,i][l];return{r:255*c,g:255*f,b:255*u}}function i(t,e,r,a){var n=[M(E(t).toString(16)),M(E(e).toString(16)),M(E(r).toString(16))];return a&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function s(t,e,r,a){var n=[M(H(a)),M(E(t).toString(16)),M(E(e).toString(16)),M(E(r).toString(16))];return n.join("")}function l(t,e){e=0===e?0:e||10;var r=B(t).toHsl();return r.s-=e/100,r.s=S(r.s),B(r)}function c(t,e){e=0===e?0:e||10;var r=B(t).toHsl();return r.s+=e/100,r.s=S(r.s),B(r)}function f(t){return B(t).desaturate(100)}function u(t,e){e=0===e?0:e||10;var r=B(t).toHsl();return r.l+=e/100,r.l=S(r.l),B(r)}function h(t,e){e=0===e?0:e||10;var r=B(t).toRgb();return r.r=I(0,D(255,r.r-E(255*-(e/100)))),r.g=I(0,D(255,r.g-E(255*-(e/100)))),r.b=I(0,D(255,r.b-E(255*-(e/100)))),B(r)}function d(t,e){e=0===e?0:e||10;var r=B(t).toHsl();return r.l-=e/100,r.l=S(r.l),B(r)}function p(t,e){var r=B(t).toHsl(),a=(E(r.h)+e)%360;return r.h=a<0?360+a:a,B(r)}function g(t){var e=B(t).toHsl();return e.h=(e.h+180)%360,B(e)}function b(t){var e=B(t).toHsl(),r=e.h;return[B(t),B({h:(r+120)%360,s:e.s,l:e.l}),B({h:(r+240)%360,s:e.s,l:e.l})]}function v(t){var e=B(t).toHsl(),r=e.h;return[B(t),B({h:(r+90)%360,s:e.s,l:e.l}),B({h:(r+180)%360,s:e.s,l:e.l}),B({h:(r+270)%360,s:e.s,l:e.l})]}function m(t){var e=B(t).toHsl(),r=e.h;return[B(t),B({h:(r+72)%360,s:e.s,l:e.l}),B({h:(r+216)%360,s:e.s,l:e.l})]}function y(t,e,r){e=e||6,r=r||30;var a=B(t).toHsl(),n=360/r,o=[B(t)];for(a.h=(a.h-(n*e>>1)+720)%360;--e;)a.h=(a.h+n)%360,o.push(B(a));return o}function w(t,e){e=e||6;for(var r=B(t).toHsv(),a=r.h,n=r.s,o=r.v,i=[],s=1/e;e--;)i.push(B({h:a,s:n,v:o})),o=(o+s)%1;return i}function _(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function x(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function k(t,e){P(t)&&(t="100%");var r=A(t);return t=D(e,I(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),j.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function S(t){return D(1,I(0,t))}function C(t){return parseInt(t,16)}function P(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function A(t){return"string"==typeof t&&t.indexOf("%")!=-1}function M(t){return 1==t.length?"0"+t:""+t}function R(t){return t<=1&&(t=100*t+"%"),t}function H(t){return Math.round(255*parseFloat(t)).toString(16)}function F(t){return C(t)/255}function T(t){t=t.replace(O,"").replace(q,"").toLowerCase();var e=!1;if(L[t])t=L[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=V.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=V.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=V.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=V.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=V.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=V.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=V.hex8.exec(t))?{a:F(r[1]),r:C(r[2]),g:C(r[3]),b:C(r[4]),format:e?"name":"hex8"}:(r=V.hex6.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),format:e?"name":"hex"}:!!(r=V.hex3.exec(t))&&{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),format:e?"name":"hex"}}var O=/^[\s,#]+/,q=/\s+$/,N=0,j=Math,E=j.round,D=j.min,I=j.max,z=j.random,B=function(e,r){if(e=e?e:"",r=r||{},e instanceof B)return e;if(!(this instanceof B))return new B(e,r);var a=t(e);this._originalInput=e,this._r=a.r,this._g=a.g,this._b=a.b,this._a=a.a,this._roundA=E(1e3*this._a)/1e3,this._format=r.format||a.format,this._gradientType=r.gradientType,this._r<1&&(this._r=E(this._r)),this._g<1&&(this._g=E(this._g)),this._b<1&&(this._b=E(this._b)),this._ok=a.ok,this._tc_id=N++};B.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},setAlpha:function(t){return this._a=x(t),this._roundA=E(1e3*this._a)/1e3,this},toHsv:function(){var t=n(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=n(this._r,this._g,this._b),e=E(360*t.h),r=E(100*t.s),a=E(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+a+"%)":"hsva("+e+", "+r+"%, "+a+"%, "+this._roundA+")"},toHsl:function(){var t=r(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=r(this._r,this._g,this._b),e=E(360*t.h),a=E(100*t.s),n=E(100*t.l);return 1==this._a?"hsl("+e+", "+a+"%, "+n+"%)":"hsla("+e+", "+a+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return i(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(){return s(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:E(this._r),g:E(this._g),b:E(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+E(this._r)+", "+E(this._g)+", "+E(this._b)+")":"rgba("+E(this._r)+", "+E(this._g)+", "+E(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:E(100*k(this._r,255))+"%",g:E(100*k(this._g,255))+"%",b:E(100*k(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+E(100*k(this._r,255))+"%, "+E(100*k(this._g,255))+"%, "+E(100*k(this._b,255))+"%)":"rgba("+E(100*k(this._r,255))+"%, "+E(100*k(this._g,255))+"%, "+E(100*k(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(K[i(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+s(this._r,this._g,this._b,this._a),r=e,a=this._gradientType?"GradientType = 1, ":"";if(t){var n=B(t);r=n.toHex8String()}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,a=this._a<1&&this._a>=0,n=!e&&a&&("hex"===t||"hex6"===t||"hex3"===t||"name"===t);return n?"name"===t&&0===this._a?this.toName():this.toRgbString():("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString())},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(u,arguments)},brighten:function(){return this._applyModification(h,arguments)},darken:function(){return this._applyModification(d,arguments)},desaturate:function(){return this._applyModification(l,arguments)},saturate:function(){return this._applyModification(c,arguments)},greyscale:function(){return this._applyModification(f,arguments)},spin:function(){return this._applyModification(p,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(y,arguments)},complement:function(){return this._applyCombination(g,arguments)},monochromatic:function(){return this._applyCombination(w,arguments)},splitcomplement:function(){return this._applyCombination(m,arguments)},triad:function(){return this._applyCombination(b,arguments)},tetrad:function(){return this._applyCombination(v,arguments)}},B.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var a in t)t.hasOwnProperty(a)&&("a"===a?r[a]=t[a]:r[a]=R(t[a]));t=r}return B(t,e)},B.equals=function(t,e){return!(!t||!e)&&B(t).toRgbString()==B(e).toRgbString()},B.random=function(){return B.fromRatio({r:z(),g:z(),b:z()})},B.mix=function(t,e,r){r=0===r?0:r||50;var a,n=B(t).toRgb(),o=B(e).toRgb(),i=r/100,s=2*i-1,l=o.a-n.a;a=s*l==-1?s:(s+l)/(1+s*l),a=(a+1)/2;var c=1-a,f={r:o.r*a+n.r*c,g:o.g*a+n.g*c,b:o.b*a+n.b*c,a:o.a*i+n.a*(1-i)};return B(f)},B.readability=function(t,e){var r=B(t),a=B(e),n=r.toRgb(),o=a.toRgb(),i=r.getBrightness(),s=a.getBrightness(),l=Math.max(n.r,o.r)-Math.min(n.r,o.r)+Math.max(n.g,o.g)-Math.min(n.g,o.g)+Math.max(n.b,o.b)-Math.min(n.b,o.b);return{brightness:Math.abs(i-s),color:l}},B.isReadable=function(t,e){var r=B.readability(t,e);return r.brightness>125&&r.color>500},B.mostReadable=function(t,e){for(var r=null,a=0,n=!1,o=0;o<e.length;o++){var i=B.readability(t,e[o]),s=i.brightness>125&&i.color>500,l=3*(i.brightness/125)+i.color/500;(s&&!n||s&&n&&l>a||!s&&!n&&l>a)&&(n=s,a=l,r=B(e[o]))}return r};var L=B.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},K=B.hexNames=_(L),V=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",a="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{rgb:new RegExp("rgb"+a),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+a),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+a),hsva:new RegExp("hsva"+n),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();window.tinycolor=B}(),t(function(){t.fn.spectrum.load&&t.fn.spectrum.processNativeColorInputs()})});
/*!
 * Materialize v0.97.8 (http://materializecss.com)
 * Copyright 2014-2015 Materialize
 * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
 */
if("undefined"==typeof jQuery){var jQuery;jQuery="function"==typeof require?$=require("jquery"):$}/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 *
 * Open source under the BSD License.
 *
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this list of
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list
 * of conditions and the following disclaimer in the documentation and/or other materials
 * provided with the distribution.
 *
 * Neither the name of the author nor the names of contributors may be used to endorse
 * or promote products derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
*/
jQuery.easing.jswing=jQuery.easing.swing,jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(t,e,i,n,a){return jQuery.easing[jQuery.easing.def](t,e,i,n,a)},easeInQuad:function(t,e,i,n,a){return n*(e/=a)*e+i},easeOutQuad:function(t,e,i,n,a){return-n*(e/=a)*(e-2)+i},easeInOutQuad:function(t,e,i,n,a){return(e/=a/2)<1?n/2*e*e+i:-n/2*(--e*(e-2)-1)+i},easeInCubic:function(t,e,i,n,a){return n*(e/=a)*e*e+i},easeOutCubic:function(t,e,i,n,a){return n*((e=e/a-1)*e*e+1)+i},easeInOutCubic:function(t,e,i,n,a){return(e/=a/2)<1?n/2*e*e*e+i:n/2*((e-=2)*e*e+2)+i},easeInQuart:function(t,e,i,n,a){return n*(e/=a)*e*e*e+i},easeOutQuart:function(t,e,i,n,a){return-n*((e=e/a-1)*e*e*e-1)+i},easeInOutQuart:function(t,e,i,n,a){return(e/=a/2)<1?n/2*e*e*e*e+i:-n/2*((e-=2)*e*e*e-2)+i},easeInQuint:function(t,e,i,n,a){return n*(e/=a)*e*e*e*e+i},easeOutQuint:function(t,e,i,n,a){return n*((e=e/a-1)*e*e*e*e+1)+i},easeInOutQuint:function(t,e,i,n,a){return(e/=a/2)<1?n/2*e*e*e*e*e+i:n/2*((e-=2)*e*e*e*e+2)+i},easeInSine:function(t,e,i,n,a){return-n*Math.cos(e/a*(Math.PI/2))+n+i},easeOutSine:function(t,e,i,n,a){return n*Math.sin(e/a*(Math.PI/2))+i},easeInOutSine:function(t,e,i,n,a){return-n/2*(Math.cos(Math.PI*e/a)-1)+i},easeInExpo:function(t,e,i,n,a){return 0==e?i:n*Math.pow(2,10*(e/a-1))+i},easeOutExpo:function(t,e,i,n,a){return e==a?i+n:n*(-Math.pow(2,-10*e/a)+1)+i},easeInOutExpo:function(t,e,i,n,a){return 0==e?i:e==a?i+n:(e/=a/2)<1?n/2*Math.pow(2,10*(e-1))+i:n/2*(-Math.pow(2,-10*--e)+2)+i},easeInCirc:function(t,e,i,n,a){return-n*(Math.sqrt(1-(e/=a)*e)-1)+i},easeOutCirc:function(t,e,i,n,a){return n*Math.sqrt(1-(e=e/a-1)*e)+i},easeInOutCirc:function(t,e,i,n,a){return(e/=a/2)<1?-n/2*(Math.sqrt(1-e*e)-1)+i:n/2*(Math.sqrt(1-(e-=2)*e)+1)+i},easeInElastic:function(t,e,i,n,a){var o=1.70158,r=0,s=n;if(0==e)return i;if(1==(e/=a))return i+n;if(r||(r=.3*a),s<Math.abs(n)){s=n;var o=r/4}else var o=r/(2*Math.PI)*Math.asin(n/s);return-(s*Math.pow(2,10*(e-=1))*Math.sin((e*a-o)*(2*Math.PI)/r))+i},easeOutElastic:function(t,e,i,n,a){var o=1.70158,r=0,s=n;if(0==e)return i;if(1==(e/=a))return i+n;if(r||(r=.3*a),s<Math.abs(n)){s=n;var o=r/4}else var o=r/(2*Math.PI)*Math.asin(n/s);return s*Math.pow(2,-10*e)*Math.sin((e*a-o)*(2*Math.PI)/r)+n+i},easeInOutElastic:function(t,e,i,n,a){var o=1.70158,r=0,s=n;if(0==e)return i;if(2==(e/=a/2))return i+n;if(r||(r=a*(.3*1.5)),s<Math.abs(n)){s=n;var o=r/4}else var o=r/(2*Math.PI)*Math.asin(n/s);return e<1?-.5*(s*Math.pow(2,10*(e-=1))*Math.sin((e*a-o)*(2*Math.PI)/r))+i:s*Math.pow(2,-10*(e-=1))*Math.sin((e*a-o)*(2*Math.PI)/r)*.5+n+i},easeInBack:function(t,e,i,n,a,o){return void 0==o&&(o=1.70158),n*(e/=a)*e*((o+1)*e-o)+i},easeOutBack:function(t,e,i,n,a,o){return void 0==o&&(o=1.70158),n*((e=e/a-1)*e*((o+1)*e+o)+1)+i},easeInOutBack:function(t,e,i,n,a,o){return void 0==o&&(o=1.70158),(e/=a/2)<1?n/2*(e*e*(((o*=1.525)+1)*e-o))+i:n/2*((e-=2)*e*(((o*=1.525)+1)*e+o)+2)+i},easeInBounce:function(t,e,i,n,a){return n-jQuery.easing.easeOutBounce(t,a-e,0,n,a)+i},easeOutBounce:function(t,e,i,n,a){return(e/=a)<1/2.75?n*(7.5625*e*e)+i:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+i:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+i:n*(7.5625*(e-=2.625/2.75)*e+.984375)+i},easeInOutBounce:function(t,e,i,n,a){return e<a/2?.5*jQuery.easing.easeInBounce(t,2*e,0,n,a)+i:.5*jQuery.easing.easeOutBounce(t,2*e-a,0,n,a)+.5*n+i}}),jQuery.extend(jQuery.easing,{easeInOutMaterial:function(t,e,i,n,a){return(e/=a/2)<1?n/2*e*e+i:n/4*((e-=2)*e*e+2)+i}}),/*! VelocityJS.org (1.2.3). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */
/*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */
/*! Note that this has been modified by Materialize to confirm that Velocity is not already being imported. */
jQuery.Velocity?console.log("Velocity is already loaded. You may be needlessly importing Velocity again; note that Materialize includes Velocity."):(!function(t){function e(t){var e=t.length,n=i.type(t);return"function"!==n&&!i.isWindow(t)&&(!(1!==t.nodeType||!e)||("array"===n||0===e||"number"==typeof e&&e>0&&e-1 in t))}if(!t.jQuery){var i=function(t,e){return new i.fn.init(t,e)};i.isWindow=function(t){return null!=t&&t==t.window},i.type=function(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?a[r.call(t)]||"object":typeof t},i.isArray=Array.isArray||function(t){return"array"===i.type(t)},i.isPlainObject=function(t){var e;if(!t||"object"!==i.type(t)||t.nodeType||i.isWindow(t))return!1;try{if(t.constructor&&!o.call(t,"constructor")&&!o.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}for(e in t);return void 0===e||o.call(t,e)},i.each=function(t,i,n){var a,o=0,r=t.length,s=e(t);if(n){if(s)for(;r>o&&(a=i.apply(t[o],n),a!==!1);o++);else for(o in t)if(a=i.apply(t[o],n),a===!1)break}else if(s)for(;r>o&&(a=i.call(t[o],o,t[o]),a!==!1);o++);else for(o in t)if(a=i.call(t[o],o,t[o]),a===!1)break;return t},i.data=function(t,e,a){if(void 0===a){var o=t[i.expando],r=o&&n[o];if(void 0===e)return r;if(r&&e in r)return r[e]}else if(void 0!==e){var o=t[i.expando]||(t[i.expando]=++i.uuid);return n[o]=n[o]||{},n[o][e]=a,a}},i.removeData=function(t,e){var a=t[i.expando],o=a&&n[a];o&&i.each(e,function(t,e){delete o[e]})},i.extend=function(){var t,e,n,a,o,r,s=arguments[0]||{},l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[l]||{},l++),"object"!=typeof s&&"function"!==i.type(s)&&(s={}),l===c&&(s=this,l--);c>l;l++)if(null!=(o=arguments[l]))for(a in o)t=s[a],n=o[a],s!==n&&(u&&n&&(i.isPlainObject(n)||(e=i.isArray(n)))?(e?(e=!1,r=t&&i.isArray(t)?t:[]):r=t&&i.isPlainObject(t)?t:{},s[a]=i.extend(u,r,n)):void 0!==n&&(s[a]=n));return s},i.queue=function(t,n,a){function o(t,i){var n=i||[];return null!=t&&(e(Object(t))?!function(t,e){for(var i=+e.length,n=0,a=t.length;i>n;)t[a++]=e[n++];if(i!==i)for(;void 0!==e[n];)t[a++]=e[n++];return t.length=a,t}(n,"string"==typeof t?[t]:t):[].push.call(n,t)),n}if(t){n=(n||"fx")+"queue";var r=i.data(t,n);return a?(!r||i.isArray(a)?r=i.data(t,n,o(a)):r.push(a),r):r||[]}},i.dequeue=function(t,e){i.each(t.nodeType?[t]:t,function(t,n){e=e||"fx";var a=i.queue(n,e),o=a.shift();"inprogress"===o&&(o=a.shift()),o&&("fx"===e&&a.unshift("inprogress"),o.call(n,function(){i.dequeue(n,e)}))})},i.fn=i.prototype={init:function(t){if(t.nodeType)return this[0]=t,this;throw new Error("Not a DOM node.")},offset:function(){var e=this[0].getBoundingClientRect?this[0].getBoundingClientRect():{top:0,left:0};return{top:e.top+(t.pageYOffset||document.scrollTop||0)-(document.clientTop||0),left:e.left+(t.pageXOffset||document.scrollLeft||0)-(document.clientLeft||0)}},position:function(){function t(){for(var t=this.offsetParent||document;t&&"html"===!t.nodeType.toLowerCase&&"static"===t.style.position;)t=t.offsetParent;return t||document}var e=this[0],t=t.apply(e),n=this.offset(),a=/^(?:body|html)$/i.test(t.nodeName)?{top:0,left:0}:i(t).offset();return n.top-=parseFloat(e.style.marginTop)||0,n.left-=parseFloat(e.style.marginLeft)||0,t.style&&(a.top+=parseFloat(t.style.borderTopWidth)||0,a.left+=parseFloat(t.style.borderLeftWidth)||0),{top:n.top-a.top,left:n.left-a.left}}};var n={};i.expando="velocity"+(new Date).getTime(),i.uuid=0;for(var a={},o=a.hasOwnProperty,r=a.toString,s="Boolean Number String Function Array Date RegExp Object Error".split(" "),l=0;l<s.length;l++)a["[object "+s[l]+"]"]=s[l].toLowerCase();i.fn.init.prototype=i.fn,t.Velocity={Utilities:i}}}(window),function(t){"object"==typeof module&&"object"==typeof module.exports?module.exports=t():"function"==typeof define&&define.amd?define(t):t()}(function(){return function(t,e,i,n){function a(t){for(var e=-1,i=t?t.length:0,n=[];++e<i;){var a=t[e];a&&n.push(a)}return n}function o(t){return v.isWrapped(t)?t=[].slice.call(t):v.isNode(t)&&(t=[t]),t}function r(t){var e=p.data(t,"velocity");return null===e?n:e}function s(t){return function(e){return Math.round(e*t)*(1/t)}}function l(t,i,n,a){function o(t,e){return 1-3*e+3*t}function r(t,e){return 3*e-6*t}function s(t){return 3*t}function l(t,e,i){return((o(e,i)*t+r(e,i))*t+s(e))*t}function c(t,e,i){return 3*o(e,i)*t*t+2*r(e,i)*t+s(e)}function u(e,i){for(var a=0;v>a;++a){var o=c(i,t,n);if(0===o)return i;var r=l(i,t,n)-e;i-=r/o}return i}function d(){for(var e=0;b>e;++e)k[e]=l(e*w,t,n)}function p(e,i,a){var o,r,s=0;do r=i+(a-i)/2,o=l(r,t,n)-e,o>0?a=r:i=r;while(Math.abs(o)>m&&++s<y);return r}function f(e){for(var i=0,a=1,o=b-1;a!=o&&k[a]<=e;++a)i+=w;--a;var r=(e-k[a])/(k[a+1]-k[a]),s=i+r*w,l=c(s,t,n);return l>=g?u(e,s):0==l?s:p(e,i,i+w)}function h(){T=!0,(t!=i||n!=a)&&d()}var v=4,g=.001,m=1e-7,y=10,b=11,w=1/(b-1),x="Float32Array"in e;if(4!==arguments.length)return!1;for(var C=0;4>C;++C)if("number"!=typeof arguments[C]||isNaN(arguments[C])||!isFinite(arguments[C]))return!1;t=Math.min(t,1),n=Math.min(n,1),t=Math.max(t,0),n=Math.max(n,0);var k=x?new Float32Array(b):new Array(b),T=!1,S=function(e){return T||h(),t===i&&n===a?e:0===e?0:1===e?1:l(f(e),i,a)};S.getControlPoints=function(){return[{x:t,y:i},{x:n,y:a}]};var P="generateBezier("+[t,i,n,a]+")";return S.toString=function(){return P},S}function c(t,e){var i=t;return v.isString(t)?b.Easings[t]||(i=!1):i=v.isArray(t)&&1===t.length?s.apply(null,t):v.isArray(t)&&2===t.length?w.apply(null,t.concat([e])):!(!v.isArray(t)||4!==t.length)&&l.apply(null,t),i===!1&&(i=b.Easings[b.defaults.easing]?b.defaults.easing:y),i}function u(t){if(t){var e=(new Date).getTime(),i=b.State.calls.length;i>1e4&&(b.State.calls=a(b.State.calls));for(var o=0;i>o;o++)if(b.State.calls[o]){var s=b.State.calls[o],l=s[0],c=s[2],f=s[3],h=!!f,g=null;f||(f=b.State.calls[o][3]=e-16);for(var m=Math.min((e-f)/c.duration,1),y=0,w=l.length;w>y;y++){var C=l[y],T=C.element;if(r(T)){var S=!1;if(c.display!==n&&null!==c.display&&"none"!==c.display){if("flex"===c.display){var P=["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex"];p.each(P,function(t,e){x.setPropertyValue(T,"display",e)})}x.setPropertyValue(T,"display",c.display)}c.visibility!==n&&"hidden"!==c.visibility&&x.setPropertyValue(T,"visibility",c.visibility);for(var O in C)if("element"!==O){var E,I=C[O],A=v.isString(I.easing)?b.Easings[I.easing]:I.easing;if(1===m)E=I.endValue;else{var M=I.endValue-I.startValue;if(E=I.startValue+M*A(m,c,M),!h&&E===I.currentValue)continue}if(I.currentValue=E,"tween"===O)g=E;else{if(x.Hooks.registered[O]){var _=x.Hooks.getRoot(O),q=r(T).rootPropertyValueCache[_];q&&(I.rootPropertyValue=q)}var V=x.setPropertyValue(T,O,I.currentValue+(0===parseFloat(E)?"":I.unitType),I.rootPropertyValue,I.scrollData);x.Hooks.registered[O]&&(r(T).rootPropertyValueCache[_]=x.Normalizations.registered[_]?x.Normalizations.registered[_]("extract",null,V[1]):V[1]),"transform"===V[0]&&(S=!0)}}c.mobileHA&&r(T).transformCache.translate3d===n&&(r(T).transformCache.translate3d="(0px, 0px, 0px)",S=!0),S&&x.flushTransformCache(T)}}c.display!==n&&"none"!==c.display&&(b.State.calls[o][2].display=!1),c.visibility!==n&&"hidden"!==c.visibility&&(b.State.calls[o][2].visibility=!1),c.progress&&c.progress.call(s[1],s[1],m,Math.max(0,f+c.duration-e),f,g),1===m&&d(o)}}b.State.isTicking&&k(u)}function d(t,e){if(!b.State.calls[t])return!1;for(var i=b.State.calls[t][0],a=b.State.calls[t][1],o=b.State.calls[t][2],s=b.State.calls[t][4],l=!1,c=0,u=i.length;u>c;c++){var d=i[c].element;if(e||o.loop||("none"===o.display&&x.setPropertyValue(d,"display",o.display),"hidden"===o.visibility&&x.setPropertyValue(d,"visibility",o.visibility)),o.loop!==!0&&(p.queue(d)[1]===n||!/\.velocityQueueEntryFlag/i.test(p.queue(d)[1]))&&r(d)){r(d).isAnimating=!1,r(d).rootPropertyValueCache={};var f=!1;p.each(x.Lists.transforms3D,function(t,e){var i=/^scale/.test(e)?1:0,a=r(d).transformCache[e];r(d).transformCache[e]!==n&&new RegExp("^\\("+i+"[^.]").test(a)&&(f=!0,delete r(d).transformCache[e])}),o.mobileHA&&(f=!0,delete r(d).transformCache.translate3d),f&&x.flushTransformCache(d),x.Values.removeClass(d,"velocity-animating")}if(!e&&o.complete&&!o.loop&&c===u-1)try{o.complete.call(a,a)}catch(h){setTimeout(function(){throw h},1)}s&&o.loop!==!0&&s(a),r(d)&&o.loop===!0&&!e&&(p.each(r(d).tweensContainer,function(t,e){/^rotate/.test(t)&&360===parseFloat(e.endValue)&&(e.endValue=0,e.startValue=360),/^backgroundPosition/.test(t)&&100===parseFloat(e.endValue)&&"%"===e.unitType&&(e.endValue=0,e.startValue=100)}),b(d,"reverse",{loop:!0,delay:o.delay})),o.queue!==!1&&p.dequeue(d,o.queue)}b.State.calls[t]=!1;for(var v=0,g=b.State.calls.length;g>v;v++)if(b.State.calls[v]!==!1){l=!0;break}l===!1&&(b.State.isTicking=!1,delete b.State.calls,b.State.calls=[])}var p,f=function(){if(i.documentMode)return i.documentMode;for(var t=7;t>4;t--){var e=i.createElement("div");if(e.innerHTML="<!--[if IE "+t+"]><span></span><![endif]-->",e.getElementsByTagName("span").length)return e=null,t}return n}(),h=function(){var t=0;return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||function(e){var i,n=(new Date).getTime();return i=Math.max(0,16-(n-t)),t=n+i,setTimeout(function(){e(n+i)},i)}}(),v={isString:function(t){return"string"==typeof t},isArray:Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},isFunction:function(t){return"[object Function]"===Object.prototype.toString.call(t)},isNode:function(t){return t&&t.nodeType},isNodeList:function(t){return"object"==typeof t&&/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(t))&&t.length!==n&&(0===t.length||"object"==typeof t[0]&&t[0].nodeType>0)},isWrapped:function(t){return t&&(t.jquery||e.Zepto&&e.Zepto.zepto.isZ(t))},isSVG:function(t){return e.SVGElement&&t instanceof e.SVGElement},isEmptyObject:function(t){for(var e in t)return!1;return!0}},g=!1;if(t.fn&&t.fn.jquery?(p=t,g=!0):p=e.Velocity.Utilities,8>=f&&!g)throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");if(7>=f)return void(jQuery.fn.velocity=jQuery.fn.animate);var m=400,y="swing",b={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),isAndroid:/Android/i.test(navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(navigator.userAgent),isChrome:e.chrome,isFirefox:/Firefox/i.test(navigator.userAgent),prefixElement:i.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[]},CSS:{},Utilities:p,Redirects:{},Easings:{},Promise:e.Promise,defaults:{queue:"",duration:m,easing:y,begin:n,complete:n,progress:n,display:n,visibility:n,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0},init:function(t){p.data(t,"velocity",{isSVG:v.isSVG(t),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},hook:null,mock:!1,version:{major:1,minor:2,patch:2},debug:!1};e.pageYOffset!==n?(b.State.scrollAnchor=e,b.State.scrollPropertyLeft="pageXOffset",b.State.scrollPropertyTop="pageYOffset"):(b.State.scrollAnchor=i.documentElement||i.body.parentNode||i.body,b.State.scrollPropertyLeft="scrollLeft",b.State.scrollPropertyTop="scrollTop");var w=function(){function t(t){return-t.tension*t.x-t.friction*t.v}function e(e,i,n){var a={x:e.x+n.dx*i,v:e.v+n.dv*i,tension:e.tension,friction:e.friction};return{dx:a.v,dv:t(a)}}function i(i,n){var a={dx:i.v,dv:t(i)},o=e(i,.5*n,a),r=e(i,.5*n,o),s=e(i,n,r),l=1/6*(a.dx+2*(o.dx+r.dx)+s.dx),c=1/6*(a.dv+2*(o.dv+r.dv)+s.dv);return i.x=i.x+l*n,i.v=i.v+c*n,i}return function n(t,e,a){var o,r,s,l={x:-1,v:0,tension:null,friction:null},c=[0],u=0,d=1e-4,p=.016;for(t=parseFloat(t)||500,e=parseFloat(e)||20,a=a||null,l.tension=t,l.friction=e,o=null!==a,o?(u=n(t,e),r=u/a*p):r=p;s=i(s||l,r),c.push(1+s.x),u+=16,Math.abs(s.x)>d&&Math.abs(s.v)>d;);return o?function(t){return c[t*(c.length-1)|0]}:u}}();b.Easings={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},spring:function(t){return 1-Math.cos(4.5*t*Math.PI)*Math.exp(6*-t)}},p.each([["ease",[.25,.1,.25,1]],["ease-in",[.42,0,1,1]],["ease-out",[0,0,.58,1]],["ease-in-out",[.42,0,.58,1]],["easeInSine",[.47,0,.745,.715]],["easeOutSine",[.39,.575,.565,1]],["easeInOutSine",[.445,.05,.55,.95]],["easeInQuad",[.55,.085,.68,.53]],["easeOutQuad",[.25,.46,.45,.94]],["easeInOutQuad",[.455,.03,.515,.955]],["easeInCubic",[.55,.055,.675,.19]],["easeOutCubic",[.215,.61,.355,1]],["easeInOutCubic",[.645,.045,.355,1]],["easeInQuart",[.895,.03,.685,.22]],["easeOutQuart",[.165,.84,.44,1]],["easeInOutQuart",[.77,0,.175,1]],["easeInQuint",[.755,.05,.855,.06]],["easeOutQuint",[.23,1,.32,1]],["easeInOutQuint",[.86,0,.07,1]],["easeInExpo",[.95,.05,.795,.035]],["easeOutExpo",[.19,1,.22,1]],["easeInOutExpo",[1,0,0,1]],["easeInCirc",[.6,.04,.98,.335]],["easeOutCirc",[.075,.82,.165,1]],["easeInOutCirc",[.785,.135,.15,.86]]],function(t,e){b.Easings[e[0]]=l.apply(null,e[1])});var x=b.CSS={RegEx:{isHex:/^#([A-f\d]{3}){1,2}$/i,valueUnwrap:/^[A-z]+\((.*)\)$/i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Lists:{colors:["fill","stroke","stopColor","color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],transformsBase:["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"],transforms3D:["transformPerspective","translateZ","scaleZ","rotateX","rotateY"]},Hooks:{templates:{textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0px"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){for(var t=0;t<x.Lists.colors.length;t++){var e="color"===x.Lists.colors[t]?"0 0 0 1":"255 255 255 1";x.Hooks.templates[x.Lists.colors[t]]=["Red Green Blue Alpha",e]}var i,n,a;if(f)for(i in x.Hooks.templates){n=x.Hooks.templates[i],a=n[0].split(" ");var o=n[1].match(x.RegEx.valueSplit);"Color"===a[0]&&(a.push(a.shift()),o.push(o.shift()),x.Hooks.templates[i]=[a.join(" "),o.join(" ")])}for(i in x.Hooks.templates){n=x.Hooks.templates[i],a=n[0].split(" ");for(var t in a){var r=i+a[t],s=t;x.Hooks.registered[r]=[i,s]}}},getRoot:function(t){var e=x.Hooks.registered[t];return e?e[0]:t},cleanRootPropertyValue:function(t,e){return x.RegEx.valueUnwrap.test(e)&&(e=e.match(x.RegEx.valueUnwrap)[1]),x.Values.isCSSNullValue(e)&&(e=x.Hooks.templates[t][1]),e},extractValue:function(t,e){var i=x.Hooks.registered[t];if(i){var n=i[0],a=i[1];return e=x.Hooks.cleanRootPropertyValue(n,e),e.toString().match(x.RegEx.valueSplit)[a]}return e},injectValue:function(t,e,i){var n=x.Hooks.registered[t];if(n){var a,o,r=n[0],s=n[1];return i=x.Hooks.cleanRootPropertyValue(r,i),a=i.toString().match(x.RegEx.valueSplit),a[s]=e,o=a.join(" ")}return i}},Normalizations:{registered:{clip:function(t,e,i){switch(t){case"name":return"clip";case"extract":var n;return x.RegEx.wrappedValueAlreadyExtracted.test(i)?n=i:(n=i.toString().match(x.RegEx.valueUnwrap),n=n?n[1].replace(/,(\s+)?/g," "):i),n;case"inject":return"rect("+i+")"}},blur:function(t,e,i){switch(t){case"name":return b.State.isFirefox?"filter":"-webkit-filter";case"extract":var n=parseFloat(i);if(!n&&0!==n){var a=i.toString().match(/blur\(([0-9]+[A-z]+)\)/i);n=a?a[1]:0}return n;case"inject":return parseFloat(i)?"blur("+i+")":"none"}},opacity:function(t,e,i){if(8>=f)switch(t){case"name":return"filter";case"extract":var n=i.toString().match(/alpha\(opacity=(.*)\)/i);return i=n?n[1]/100:1;case"inject":return e.style.zoom=1,parseFloat(i)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(i),10)+")"}else switch(t){case"name":return"opacity";case"extract":return i;case"inject":return i}}},register:function(){9>=f||b.State.isGingerbread||(x.Lists.transformsBase=x.Lists.transformsBase.concat(x.Lists.transforms3D));for(var t=0;t<x.Lists.transformsBase.length;t++)!function(){var e=x.Lists.transformsBase[t];x.Normalizations.registered[e]=function(t,i,a){switch(t){case"name":return"transform";case"extract":return r(i)===n||r(i).transformCache[e]===n?/^scale/i.test(e)?1:0:r(i).transformCache[e].replace(/[()]/g,"");case"inject":var o=!1;switch(e.substr(0,e.length-1)){case"translate":o=!/(%|px|em|rem|vw|vh|\d)$/i.test(a);break;case"scal":case"scale":b.State.isAndroid&&r(i).transformCache[e]===n&&1>a&&(a=1),o=!/(\d)$/i.test(a);break;case"skew":o=!/(deg|\d)$/i.test(a);break;case"rotate":o=!/(deg|\d)$/i.test(a)}return o||(r(i).transformCache[e]="("+a+")"),r(i).transformCache[e]}}}();for(var t=0;t<x.Lists.colors.length;t++)!function(){var e=x.Lists.colors[t];x.Normalizations.registered[e]=function(t,i,a){switch(t){case"name":return e;case"extract":var o;if(x.RegEx.wrappedValueAlreadyExtracted.test(a))o=a;else{var r,s={black:"rgb(0, 0, 0)",blue:"rgb(0, 0, 255)",gray:"rgb(128, 128, 128)",green:"rgb(0, 128, 0)",red:"rgb(255, 0, 0)",white:"rgb(255, 255, 255)"};/^[A-z]+$/i.test(a)?r=s[a]!==n?s[a]:s.black:x.RegEx.isHex.test(a)?r="rgb("+x.Values.hexToRgb(a).join(" ")+")":/^rgba?\(/i.test(a)||(r=s.black),o=(r||a).toString().match(x.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g," ")}return 8>=f||3!==o.split(" ").length||(o+=" 1"),o;case"inject":return 8>=f?4===a.split(" ").length&&(a=a.split(/\s+/).slice(0,3).join(" ")):3===a.split(" ").length&&(a+=" 1"),(8>=f?"rgb":"rgba")+"("+a.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")"}}}()}},Names:{camelCase:function(t){return t.replace(/-(\w)/g,function(t,e){return e.toUpperCase()})},SVGAttribute:function(t){var e="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(f||b.State.isAndroid&&!b.State.isChrome)&&(e+="|transform"),new RegExp("^("+e+")$","i").test(t)},prefixCheck:function(t){if(b.State.prefixMatches[t])return[b.State.prefixMatches[t],!0];for(var e=["","Webkit","Moz","ms","O"],i=0,n=e.length;n>i;i++){var a;if(a=0===i?t:e[i]+t.replace(/^\w/,function(t){return t.toUpperCase()}),v.isString(b.State.prefixElement.style[a]))return b.State.prefixMatches[t]=a,[a,!0]}return[t,!1]}},Values:{hexToRgb:function(t){var e,i=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;return t=t.replace(i,function(t,e,i,n){return e+e+i+i+n+n}),e=n.exec(t),e?[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]:[0,0,0]},isCSSNullValue:function(t){return 0==t||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(t)},getUnitType:function(t){return/^(rotate|skew)/i.test(t)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(t)?"":"px"},getDisplayType:function(t){var e=t&&t.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(e)?"inline":/^(li)$/i.test(e)?"list-item":/^(tr)$/i.test(e)?"table-row":/^(table)$/i.test(e)?"table":/^(tbody)$/i.test(e)?"table-row-group":"block"},addClass:function(t,e){t.classList?t.classList.add(e):t.className+=(t.className.length?" ":"")+e},removeClass:function(t,e){t.classList?t.classList.remove(e):t.className=t.className.toString().replace(new RegExp("(^|\\s)"+e.split(" ").join("|")+"(\\s|$)","gi")," ")}},getPropertyValue:function(t,i,a,o){function s(t,i){function a(){c&&x.setPropertyValue(t,"display","none")}var l=0;if(8>=f)l=p.css(t,i);else{var c=!1;if(/^(width|height)$/.test(i)&&0===x.getPropertyValue(t,"display")&&(c=!0,x.setPropertyValue(t,"display",x.Values.getDisplayType(t))),!o){if("height"===i&&"border-box"!==x.getPropertyValue(t,"boxSizing").toString().toLowerCase()){var u=t.offsetHeight-(parseFloat(x.getPropertyValue(t,"borderTopWidth"))||0)-(parseFloat(x.getPropertyValue(t,"borderBottomWidth"))||0)-(parseFloat(x.getPropertyValue(t,"paddingTop"))||0)-(parseFloat(x.getPropertyValue(t,"paddingBottom"))||0);return a(),u}if("width"===i&&"border-box"!==x.getPropertyValue(t,"boxSizing").toString().toLowerCase()){var d=t.offsetWidth-(parseFloat(x.getPropertyValue(t,"borderLeftWidth"))||0)-(parseFloat(x.getPropertyValue(t,"borderRightWidth"))||0)-(parseFloat(x.getPropertyValue(t,"paddingLeft"))||0)-(parseFloat(x.getPropertyValue(t,"paddingRight"))||0);return a(),d}}var h;h=r(t)===n?e.getComputedStyle(t,null):r(t).computedStyle?r(t).computedStyle:r(t).computedStyle=e.getComputedStyle(t,null),"borderColor"===i&&(i="borderTopColor"),l=9===f&&"filter"===i?h.getPropertyValue(i):h[i],(""===l||null===l)&&(l=t.style[i]),a()}if("auto"===l&&/^(top|right|bottom|left)$/i.test(i)){var v=s(t,"position");("fixed"===v||"absolute"===v&&/top|left/i.test(i))&&(l=p(t).position()[i]+"px")}return l}var l;if(x.Hooks.registered[i]){var c=i,u=x.Hooks.getRoot(c);a===n&&(a=x.getPropertyValue(t,x.Names.prefixCheck(u)[0])),x.Normalizations.registered[u]&&(a=x.Normalizations.registered[u]("extract",t,a)),l=x.Hooks.extractValue(c,a)}else if(x.Normalizations.registered[i]){var d,h;d=x.Normalizations.registered[i]("name",t),"transform"!==d&&(h=s(t,x.Names.prefixCheck(d)[0]),x.Values.isCSSNullValue(h)&&x.Hooks.templates[i]&&(h=x.Hooks.templates[i][1])),l=x.Normalizations.registered[i]("extract",t,h)}if(!/^[\d-]/.test(l))if(r(t)&&r(t).isSVG&&x.Names.SVGAttribute(i))if(/^(height|width)$/i.test(i))try{l=t.getBBox()[i]}catch(v){l=0}else l=t.getAttribute(i);else l=s(t,x.Names.prefixCheck(i)[0]);return x.Values.isCSSNullValue(l)&&(l=0),b.debug>=2&&console.log("Get "+i+": "+l),l},setPropertyValue:function(t,i,n,a,o){var s=i;if("scroll"===i)o.container?o.container["scroll"+o.direction]=n:"Left"===o.direction?e.scrollTo(n,o.alternateValue):e.scrollTo(o.alternateValue,n);else if(x.Normalizations.registered[i]&&"transform"===x.Normalizations.registered[i]("name",t))x.Normalizations.registered[i]("inject",t,n),s="transform",n=r(t).transformCache[i];else{if(x.Hooks.registered[i]){var l=i,c=x.Hooks.getRoot(i);a=a||x.getPropertyValue(t,c),n=x.Hooks.injectValue(l,n,a),i=c}if(x.Normalizations.registered[i]&&(n=x.Normalizations.registered[i]("inject",t,n),i=x.Normalizations.registered[i]("name",t)),s=x.Names.prefixCheck(i)[0],8>=f)try{t.style[s]=n}catch(u){b.debug&&console.log("Browser does not support ["+n+"] for ["+s+"]")}else r(t)&&r(t).isSVG&&x.Names.SVGAttribute(i)?t.setAttribute(i,n):t.style[s]=n;b.debug>=2&&console.log("Set "+i+" ("+s+"): "+n)}return[s,n]},flushTransformCache:function(t){function e(e){return parseFloat(x.getPropertyValue(t,e))}var i="";if((f||b.State.isAndroid&&!b.State.isChrome)&&r(t).isSVG){var n={translate:[e("translateX"),e("translateY")],skewX:[e("skewX")],skewY:[e("skewY")],scale:1!==e("scale")?[e("scale"),e("scale")]:[e("scaleX"),e("scaleY")],rotate:[e("rotateZ"),0,0]};p.each(r(t).transformCache,function(t){/^translate/i.test(t)?t="translate":/^scale/i.test(t)?t="scale":/^rotate/i.test(t)&&(t="rotate"),n[t]&&(i+=t+"("+n[t].join(" ")+") ",delete n[t])})}else{var a,o;p.each(r(t).transformCache,function(e){return a=r(t).transformCache[e],"transformPerspective"===e?(o=a,!0):(9===f&&"rotateZ"===e&&(e="rotate"),void(i+=e+a+" "))}),o&&(i="perspective"+o+" "+i)}x.setPropertyValue(t,"transform",i)}};x.Hooks.register(),x.Normalizations.register(),b.hook=function(t,e,i){var a=n;return t=o(t),p.each(t,function(t,o){if(r(o)===n&&b.init(o),i===n)a===n&&(a=b.CSS.getPropertyValue(o,e));else{var s=b.CSS.setPropertyValue(o,e,i);"transform"===s[0]&&b.CSS.flushTransformCache(o),a=s}}),a};var C=function(){function t(){return s?O.promise||null:l}function a(){function t(t){function d(t,e){var i=n,a=n,r=n;return v.isArray(t)?(i=t[0],!v.isArray(t[1])&&/^[\d-]/.test(t[1])||v.isFunction(t[1])||x.RegEx.isHex.test(t[1])?r=t[1]:(v.isString(t[1])&&!x.RegEx.isHex.test(t[1])||v.isArray(t[1]))&&(a=e?t[1]:c(t[1],s.duration),t[2]!==n&&(r=t[2]))):i=t,e||(a=a||s.easing),v.isFunction(i)&&(i=i.call(o,T,k)),v.isFunction(r)&&(r=r.call(o,T,k)),[i||0,a,r]}function f(t,e){var i,n;return n=(e||"0").toString().toLowerCase().replace(/[%A-z]+$/,function(t){return i=t,""}),i||(i=x.Values.getUnitType(t)),[n,i]}function m(){var t={myParent:o.parentNode||i.body,position:x.getPropertyValue(o,"position"),fontSize:x.getPropertyValue(o,"fontSize")},n=t.position===V.lastPosition&&t.myParent===V.lastParent,a=t.fontSize===V.lastFontSize;V.lastParent=t.myParent,V.lastPosition=t.position,V.lastFontSize=t.fontSize;var s=100,l={};if(a&&n)l.emToPx=V.lastEmToPx,l.percentToPxWidth=V.lastPercentToPxWidth,l.percentToPxHeight=V.lastPercentToPxHeight;else{var c=r(o).isSVG?i.createElementNS("http://www.w3.org/2000/svg","rect"):i.createElement("div");b.init(c),t.myParent.appendChild(c),p.each(["overflow","overflowX","overflowY"],function(t,e){b.CSS.setPropertyValue(c,e,"hidden")}),b.CSS.setPropertyValue(c,"position",t.position),b.CSS.setPropertyValue(c,"fontSize",t.fontSize),b.CSS.setPropertyValue(c,"boxSizing","content-box"),p.each(["minWidth","maxWidth","width","minHeight","maxHeight","height"],function(t,e){b.CSS.setPropertyValue(c,e,s+"%")}),b.CSS.setPropertyValue(c,"paddingLeft",s+"em"),l.percentToPxWidth=V.lastPercentToPxWidth=(parseFloat(x.getPropertyValue(c,"width",null,!0))||1)/s,l.percentToPxHeight=V.lastPercentToPxHeight=(parseFloat(x.getPropertyValue(c,"height",null,!0))||1)/s,l.emToPx=V.lastEmToPx=(parseFloat(x.getPropertyValue(c,"paddingLeft"))||1)/s,t.myParent.removeChild(c)}return null===V.remToPx&&(V.remToPx=parseFloat(x.getPropertyValue(i.body,"fontSize"))||16),null===V.vwToPx&&(V.vwToPx=parseFloat(e.innerWidth)/100,V.vhToPx=parseFloat(e.innerHeight)/100),l.remToPx=V.remToPx,l.vwToPx=V.vwToPx,l.vhToPx=V.vhToPx,b.debug>=1&&console.log("Unit ratios: "+JSON.stringify(l),o),l}if(s.begin&&0===T)try{s.begin.call(h,h)}catch(w){setTimeout(function(){throw w},1)}if("scroll"===E){var C,S,P,I=/^x$/i.test(s.axis)?"Left":"Top",A=parseFloat(s.offset)||0;s.container?v.isWrapped(s.container)||v.isNode(s.container)?(s.container=s.container[0]||s.container,C=s.container["scroll"+I],P=C+p(o).position()[I.toLowerCase()]+A):s.container=null:(C=b.State.scrollAnchor[b.State["scrollProperty"+I]],S=b.State.scrollAnchor[b.State["scrollProperty"+("Left"===I?"Top":"Left")]],P=p(o).offset()[I.toLowerCase()]+A),l={scroll:{rootPropertyValue:!1,startValue:C,currentValue:C,endValue:P,unitType:"",easing:s.easing,scrollData:{container:s.container,direction:I,alternateValue:S}},element:o},b.debug&&console.log("tweensContainer (scroll): ",l.scroll,o)}else if("reverse"===E){if(!r(o).tweensContainer)return void p.dequeue(o,s.queue);"none"===r(o).opts.display&&(r(o).opts.display="auto"),"hidden"===r(o).opts.visibility&&(r(o).opts.visibility="visible"),r(o).opts.loop=!1,r(o).opts.begin=null,r(o).opts.complete=null,y.easing||delete s.easing,y.duration||delete s.duration,s=p.extend({},r(o).opts,s);var M=p.extend(!0,{},r(o).tweensContainer);for(var _ in M)if("element"!==_){var q=M[_].startValue;M[_].startValue=M[_].currentValue=M[_].endValue,M[_].endValue=q,v.isEmptyObject(y)||(M[_].easing=s.easing),b.debug&&console.log("reverse tweensContainer ("+_+"): "+JSON.stringify(M[_]),o)}l=M}else if("start"===E){var M;r(o).tweensContainer&&r(o).isAnimating===!0&&(M=r(o).tweensContainer),p.each(g,function(t,e){if(RegExp("^"+x.Lists.colors.join("$|^")+"$").test(t)){var i=d(e,!0),a=i[0],o=i[1],r=i[2];if(x.RegEx.isHex.test(a)){for(var s=["Red","Green","Blue"],l=x.Values.hexToRgb(a),c=r?x.Values.hexToRgb(r):n,u=0;u<s.length;u++){var p=[l[u]];o&&p.push(o),c!==n&&p.push(c[u]),g[t+s[u]]=p}delete g[t]}}});for(var z in g){var D=d(g[z]),L=D[0],H=D[1],N=D[2];z=x.Names.camelCase(z);var F=x.Hooks.getRoot(z),Q=!1;if(r(o).isSVG||"tween"===F||x.Names.prefixCheck(F)[1]!==!1||x.Normalizations.registered[F]!==n){(s.display!==n&&null!==s.display&&"none"!==s.display||s.visibility!==n&&"hidden"!==s.visibility)&&/opacity|filter/.test(z)&&!N&&0!==L&&(N=0),s._cacheValues&&M&&M[z]?(N===n&&(N=M[z].endValue+M[z].unitType),Q=r(o).rootPropertyValueCache[F]):x.Hooks.registered[z]?N===n?(Q=x.getPropertyValue(o,F),N=x.getPropertyValue(o,z,Q)):Q=x.Hooks.templates[F][1]:N===n&&(N=x.getPropertyValue(o,z));var W,$,R,X=!1;if(W=f(z,N),N=W[0],R=W[1],W=f(z,L),L=W[0].replace(/^([+-\/*])=/,function(t,e){return X=e,""}),$=W[1],N=parseFloat(N)||0,L=parseFloat(L)||0,"%"===$&&(/^(fontSize|lineHeight)$/.test(z)?(L/=100,$="em"):/^scale/.test(z)?(L/=100,$=""):/(Red|Green|Blue)$/i.test(z)&&(L=L/100*255,$="")),/[\/*]/.test(X))$=R;else if(R!==$&&0!==N)if(0===L)$=R;else{a=a||m();var Y=/margin|padding|left|right|width|text|word|letter/i.test(z)||/X$/.test(z)||"x"===z?"x":"y";switch(R){case"%":N*="x"===Y?a.percentToPxWidth:a.percentToPxHeight;break;case"px":break;default:N*=a[R+"ToPx"]}switch($){case"%":N*=1/("x"===Y?a.percentToPxWidth:a.percentToPxHeight);break;case"px":break;default:N*=1/a[$+"ToPx"]}}switch(X){case"+":L=N+L;break;case"-":L=N-L;break;case"*":L=N*L;break;case"/":L=N/L}l[z]={rootPropertyValue:Q,startValue:N,currentValue:N,endValue:L,unitType:$,easing:H},b.debug&&console.log("tweensContainer ("+z+"): "+JSON.stringify(l[z]),o)}else b.debug&&console.log("Skipping ["+F+"] due to a lack of browser support.")}l.element=o}l.element&&(x.Values.addClass(o,"velocity-animating"),j.push(l),""===s.queue&&(r(o).tweensContainer=l,r(o).opts=s),r(o).isAnimating=!0,T===k-1?(b.State.calls.push([j,h,s,null,O.resolver]),b.State.isTicking===!1&&(b.State.isTicking=!0,u())):T++)}var a,o=this,s=p.extend({},b.defaults,y),l={};switch(r(o)===n&&b.init(o),parseFloat(s.delay)&&s.queue!==!1&&p.queue(o,s.queue,function(t){b.velocityQueueEntryFlag=!0,r(o).delayTimer={setTimeout:setTimeout(t,parseFloat(s.delay)),next:t}}),s.duration.toString().toLowerCase()){case"fast":s.duration=200;break;case"normal":s.duration=m;break;case"slow":s.duration=600;break;default:s.duration=parseFloat(s.duration)||1}b.mock!==!1&&(b.mock===!0?s.duration=s.delay=1:(s.duration*=parseFloat(b.mock)||1,s.delay*=parseFloat(b.mock)||1)),s.easing=c(s.easing,s.duration),s.begin&&!v.isFunction(s.begin)&&(s.begin=null),s.progress&&!v.isFunction(s.progress)&&(s.progress=null),s.complete&&!v.isFunction(s.complete)&&(s.complete=null),s.display!==n&&null!==s.display&&(s.display=s.display.toString().toLowerCase(),"auto"===s.display&&(s.display=b.CSS.Values.getDisplayType(o))),s.visibility!==n&&null!==s.visibility&&(s.visibility=s.visibility.toString().toLowerCase()),s.mobileHA=s.mobileHA&&b.State.isMobile&&!b.State.isGingerbread,s.queue===!1?s.delay?setTimeout(t,s.delay):t():p.queue(o,s.queue,function(e,i){return i===!0?(O.promise&&O.resolver(h),!0):(b.velocityQueueEntryFlag=!0,void t(e))}),""!==s.queue&&"fx"!==s.queue||"inprogress"===p.queue(o)[0]||p.dequeue(o)}var s,l,f,h,g,y,w=arguments[0]&&(arguments[0].p||p.isPlainObject(arguments[0].properties)&&!arguments[0].properties.names||v.isString(arguments[0].properties));if(v.isWrapped(this)?(s=!1,f=0,h=this,l=this):(s=!0,f=1,h=w?arguments[0].elements||arguments[0].e:arguments[0]),h=o(h)){w?(g=arguments[0].properties||arguments[0].p,y=arguments[0].options||arguments[0].o):(g=arguments[f],y=arguments[f+1]);var k=h.length,T=0;if(!/^(stop|finish)$/i.test(g)&&!p.isPlainObject(y)){var S=f+1;y={};for(var P=S;P<arguments.length;P++)v.isArray(arguments[P])||!/^(fast|normal|slow)$/i.test(arguments[P])&&!/^\d/.test(arguments[P])?v.isString(arguments[P])||v.isArray(arguments[P])?y.easing=arguments[P]:v.isFunction(arguments[P])&&(y.complete=arguments[P]):y.duration=arguments[P]}var O={promise:null,resolver:null,rejecter:null};s&&b.Promise&&(O.promise=new b.Promise(function(t,e){O.resolver=t,O.rejecter=e}));var E;switch(g){case"scroll":E="scroll";break;case"reverse":E="reverse";break;case"finish":case"stop":p.each(h,function(t,e){r(e)&&r(e).delayTimer&&(clearTimeout(r(e).delayTimer.setTimeout),r(e).delayTimer.next&&r(e).delayTimer.next(),delete r(e).delayTimer)});var I=[];return p.each(b.State.calls,function(t,e){e&&p.each(e[1],function(i,a){var o=y===n?"":y;return o!==!0&&e[2].queue!==o&&(y!==n||e[2].queue!==!1)||void p.each(h,function(i,n){n===a&&((y===!0||v.isString(y))&&(p.each(p.queue(n,v.isString(y)?y:""),function(t,e){
v.isFunction(e)&&e(null,!0)}),p.queue(n,v.isString(y)?y:"",[])),"stop"===g?(r(n)&&r(n).tweensContainer&&o!==!1&&p.each(r(n).tweensContainer,function(t,e){e.endValue=e.currentValue}),I.push(t)):"finish"===g&&(e[2].duration=1))})})}),"stop"===g&&(p.each(I,function(t,e){d(e,!0)}),O.promise&&O.resolver(h)),t();default:if(!p.isPlainObject(g)||v.isEmptyObject(g)){if(v.isString(g)&&b.Redirects[g]){var A=p.extend({},y),M=A.duration,_=A.delay||0;return A.backwards===!0&&(h=p.extend(!0,[],h).reverse()),p.each(h,function(t,e){parseFloat(A.stagger)?A.delay=_+parseFloat(A.stagger)*t:v.isFunction(A.stagger)&&(A.delay=_+A.stagger.call(e,t,k)),A.drag&&(A.duration=parseFloat(M)||(/^(callout|transition)/.test(g)?1e3:m),A.duration=Math.max(A.duration*(A.backwards?1-t/k:(t+1)/k),.75*A.duration,200)),b.Redirects[g].call(e,e,A||{},t,k,h,O.promise?O:n)}),t()}var q="Velocity: First argument ("+g+") was not a property map, a known action, or a registered redirect. Aborting.";return O.promise?O.rejecter(new Error(q)):console.log(q),t()}E="start"}var V={lastParent:null,lastPosition:null,lastFontSize:null,lastPercentToPxWidth:null,lastPercentToPxHeight:null,lastEmToPx:null,remToPx:null,vwToPx:null,vhToPx:null},j=[];p.each(h,function(t,e){v.isNode(e)&&a.call(e)});var z,A=p.extend({},b.defaults,y);if(A.loop=parseInt(A.loop),z=2*A.loop-1,A.loop)for(var D=0;z>D;D++){var L={delay:A.delay,progress:A.progress};D===z-1&&(L.display=A.display,L.visibility=A.visibility,L.complete=A.complete),C(h,"reverse",L)}return t()}};b=p.extend(C,b),b.animate=C;var k=e.requestAnimationFrame||h;return b.State.isMobile||i.hidden===n||i.addEventListener("visibilitychange",function(){i.hidden?(k=function(t){return setTimeout(function(){t(!0)},16)},u()):k=e.requestAnimationFrame||h}),t.Velocity=b,t!==e&&(t.fn.velocity=C,t.fn.velocity.defaults=b.defaults),p.each(["Down","Up"],function(t,e){b.Redirects["slide"+e]=function(t,i,a,o,r,s){var l=p.extend({},i),c=l.begin,u=l.complete,d={height:"",marginTop:"",marginBottom:"",paddingTop:"",paddingBottom:""},f={};l.display===n&&(l.display="Down"===e?"inline"===b.CSS.Values.getDisplayType(t)?"inline-block":"block":"none"),l.begin=function(){c&&c.call(r,r);for(var i in d){f[i]=t.style[i];var n=b.CSS.getPropertyValue(t,i);d[i]="Down"===e?[n,0]:[0,n]}f.overflow=t.style.overflow,t.style.overflow="hidden"},l.complete=function(){for(var e in f)t.style[e]=f[e];u&&u.call(r,r),s&&s.resolver(r)},b(t,d,l)}}),p.each(["In","Out"],function(t,e){b.Redirects["fade"+e]=function(t,i,a,o,r,s){var l=p.extend({},i),c={opacity:"In"===e?1:0},u=l.complete;l.complete=a!==o-1?l.begin=null:function(){u&&u.call(r,r),s&&s.resolver(r)},l.display===n&&(l.display="In"===e?"auto":"none"),b(this,c,l)}}),b}(window.jQuery||window.Zepto||window,window,document)})),!function(t,e,i,n){"use strict";function a(t,e,i){return setTimeout(u(t,i),e)}function o(t,e,i){return!!Array.isArray(t)&&(r(t,i[e],i),!0)}function r(t,e,i){var a;if(t)if(t.forEach)t.forEach(e,i);else if(t.length!==n)for(a=0;a<t.length;)e.call(i,t[a],a,t),a++;else for(a in t)t.hasOwnProperty(a)&&e.call(i,t[a],a,t)}function s(t,e,i){for(var a=Object.keys(e),o=0;o<a.length;)(!i||i&&t[a[o]]===n)&&(t[a[o]]=e[a[o]]),o++;return t}function l(t,e){return s(t,e,!0)}function c(t,e,i){var n,a=e.prototype;n=t.prototype=Object.create(a),n.constructor=t,n._super=a,i&&s(n,i)}function u(t,e){return function(){return t.apply(e,arguments)}}function d(t,e){return typeof t==ut?t.apply(e?e[0]||n:n,e):t}function p(t,e){return t===n?e:t}function f(t,e,i){r(m(e),function(e){t.addEventListener(e,i,!1)})}function h(t,e,i){r(m(e),function(e){t.removeEventListener(e,i,!1)})}function v(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function g(t,e){return t.indexOf(e)>-1}function m(t){return t.trim().split(/\s+/g)}function y(t,e,i){if(t.indexOf&&!i)return t.indexOf(e);for(var n=0;n<t.length;){if(i&&t[n][i]==e||!i&&t[n]===e)return n;n++}return-1}function b(t){return Array.prototype.slice.call(t,0)}function w(t,e,i){for(var n=[],a=[],o=0;o<t.length;){var r=e?t[o][e]:t[o];y(a,r)<0&&n.push(t[o]),a[o]=r,o++}return i&&(n=e?n.sort(function(t,i){return t[e]>i[e]}):n.sort()),n}function x(t,e){for(var i,a,o=e[0].toUpperCase()+e.slice(1),r=0;r<lt.length;){if(i=lt[r],a=i?i+o:e,a in t)return a;r++}return n}function C(){return ht++}function k(t){var e=t.ownerDocument;return e.defaultView||e.parentWindow}function T(t,e){var i=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){d(t.options.enable,[t])&&i.handler(e)},this.init()}function S(t){var e,i=t.options.inputClass;return new(e=i?i:mt?H:yt?Q:gt?$:L)(t,P)}function P(t,e,i){var n=i.pointers.length,a=i.changedPointers.length,o=e&Tt&&0===n-a,r=e&(Pt|Ot)&&0===n-a;i.isFirst=!!o,i.isFinal=!!r,o&&(t.session={}),i.eventType=e,O(t,i),t.emit("hammer.input",i),t.recognize(i),t.session.prevInput=i}function O(t,e){var i=t.session,n=e.pointers,a=n.length;i.firstInput||(i.firstInput=A(e)),a>1&&!i.firstMultiple?i.firstMultiple=A(e):1===a&&(i.firstMultiple=!1);var o=i.firstInput,r=i.firstMultiple,s=r?r.center:o.center,l=e.center=M(n);e.timeStamp=ft(),e.deltaTime=e.timeStamp-o.timeStamp,e.angle=j(s,l),e.distance=V(s,l),E(i,e),e.offsetDirection=q(e.deltaX,e.deltaY),e.scale=r?D(r.pointers,n):1,e.rotation=r?z(r.pointers,n):0,I(i,e);var c=t.element;v(e.srcEvent.target,c)&&(c=e.srcEvent.target),e.target=c}function E(t,e){var i=e.center,n=t.offsetDelta||{},a=t.prevDelta||{},o=t.prevInput||{};(e.eventType===Tt||o.eventType===Pt)&&(a=t.prevDelta={x:o.deltaX||0,y:o.deltaY||0},n=t.offsetDelta={x:i.x,y:i.y}),e.deltaX=a.x+(i.x-n.x),e.deltaY=a.y+(i.y-n.y)}function I(t,e){var i,a,o,r,s=t.lastInterval||e,l=e.timeStamp-s.timeStamp;if(e.eventType!=Ot&&(l>kt||s.velocity===n)){var c=s.deltaX-e.deltaX,u=s.deltaY-e.deltaY,d=_(l,c,u);a=d.x,o=d.y,i=pt(d.x)>pt(d.y)?d.x:d.y,r=q(c,u),t.lastInterval=e}else i=s.velocity,a=s.velocityX,o=s.velocityY,r=s.direction;e.velocity=i,e.velocityX=a,e.velocityY=o,e.direction=r}function A(t){for(var e=[],i=0;i<t.pointers.length;)e[i]={clientX:dt(t.pointers[i].clientX),clientY:dt(t.pointers[i].clientY)},i++;return{timeStamp:ft(),pointers:e,center:M(e),deltaX:t.deltaX,deltaY:t.deltaY}}function M(t){var e=t.length;if(1===e)return{x:dt(t[0].clientX),y:dt(t[0].clientY)};for(var i=0,n=0,a=0;e>a;)i+=t[a].clientX,n+=t[a].clientY,a++;return{x:dt(i/e),y:dt(n/e)}}function _(t,e,i){return{x:e/t||0,y:i/t||0}}function q(t,e){return t===e?Et:pt(t)>=pt(e)?t>0?It:At:e>0?Mt:_t}function V(t,e,i){i||(i=zt);var n=e[i[0]]-t[i[0]],a=e[i[1]]-t[i[1]];return Math.sqrt(n*n+a*a)}function j(t,e,i){i||(i=zt);var n=e[i[0]]-t[i[0]],a=e[i[1]]-t[i[1]];return 180*Math.atan2(a,n)/Math.PI}function z(t,e){return j(e[1],e[0],Dt)-j(t[1],t[0],Dt)}function D(t,e){return V(e[0],e[1],Dt)/V(t[0],t[1],Dt)}function L(){this.evEl=Ht,this.evWin=Nt,this.allow=!0,this.pressed=!1,T.apply(this,arguments)}function H(){this.evEl=Wt,this.evWin=$t,T.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function N(){this.evTarget=Xt,this.evWin=Yt,this.started=!1,T.apply(this,arguments)}function F(t,e){var i=b(t.touches),n=b(t.changedTouches);return e&(Pt|Ot)&&(i=w(i.concat(n),"identifier",!0)),[i,n]}function Q(){this.evTarget=Ut,this.targetIds={},T.apply(this,arguments)}function W(t,e){var i=b(t.touches),n=this.targetIds;if(e&(Tt|St)&&1===i.length)return n[i[0].identifier]=!0,[i,i];var a,o,r=b(t.changedTouches),s=[],l=this.target;if(o=i.filter(function(t){return v(t.target,l)}),e===Tt)for(a=0;a<o.length;)n[o[a].identifier]=!0,a++;for(a=0;a<r.length;)n[r[a].identifier]&&s.push(r[a]),e&(Pt|Ot)&&delete n[r[a].identifier],a++;return s.length?[w(o.concat(s),"identifier",!0),s]:void 0}function $(){T.apply(this,arguments);var t=u(this.handler,this);this.touch=new Q(this.manager,t),this.mouse=new L(this.manager,t)}function R(t,e){this.manager=t,this.set(e)}function X(t){if(g(t,ee))return ee;var e=g(t,ie),i=g(t,ne);return e&&i?ie+" "+ne:e||i?e?ie:ne:g(t,te)?te:Kt}function Y(t){this.id=C(),this.manager=null,this.options=l(t||{},this.defaults),this.options.enable=p(this.options.enable,!0),this.state=ae,this.simultaneous={},this.requireFail=[]}function B(t){return t&ce?"cancel":t&se?"end":t&re?"move":t&oe?"start":""}function U(t){return t==_t?"down":t==Mt?"up":t==It?"left":t==At?"right":""}function G(t,e){var i=e.manager;return i?i.get(t):t}function Z(){Y.apply(this,arguments)}function J(){Z.apply(this,arguments),this.pX=null,this.pY=null}function K(){Z.apply(this,arguments)}function tt(){Y.apply(this,arguments),this._timer=null,this._input=null}function et(){Z.apply(this,arguments)}function it(){Z.apply(this,arguments)}function nt(){Y.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function at(t,e){return e=e||{},e.recognizers=p(e.recognizers,at.defaults.preset),new ot(t,e)}function ot(t,e){e=e||{},this.options=l(e,at.defaults),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.element=t,this.input=S(this),this.touchAction=new R(this,this.options.touchAction),rt(this,!0),r(e.recognizers,function(t){var e=this.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}function rt(t,e){var i=t.element;r(t.options.cssProps,function(t,n){i.style[x(i.style,n)]=e?t:""})}function st(t,i){var n=e.createEvent("Event");n.initEvent(t,!0,!0),n.gesture=i,i.target.dispatchEvent(n)}var lt=["","webkit","moz","MS","ms","o"],ct=e.createElement("div"),ut="function",dt=Math.round,pt=Math.abs,ft=Date.now,ht=1,vt=/mobile|tablet|ip(ad|hone|od)|android/i,gt="ontouchstart"in t,mt=x(t,"PointerEvent")!==n,yt=gt&&vt.test(navigator.userAgent),bt="touch",wt="pen",xt="mouse",Ct="kinect",kt=25,Tt=1,St=2,Pt=4,Ot=8,Et=1,It=2,At=4,Mt=8,_t=16,qt=It|At,Vt=Mt|_t,jt=qt|Vt,zt=["x","y"],Dt=["clientX","clientY"];T.prototype={handler:function(){},init:function(){this.evEl&&f(this.element,this.evEl,this.domHandler),this.evTarget&&f(this.target,this.evTarget,this.domHandler),this.evWin&&f(k(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&h(this.element,this.evEl,this.domHandler),this.evTarget&&h(this.target,this.evTarget,this.domHandler),this.evWin&&h(k(this.element),this.evWin,this.domHandler)}};var Lt={mousedown:Tt,mousemove:St,mouseup:Pt},Ht="mousedown",Nt="mousemove mouseup";c(L,T,{handler:function(t){var e=Lt[t.type];e&Tt&&0===t.button&&(this.pressed=!0),e&St&&1!==t.which&&(e=Pt),this.pressed&&this.allow&&(e&Pt&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:xt,srcEvent:t}))}});var Ft={pointerdown:Tt,pointermove:St,pointerup:Pt,pointercancel:Ot,pointerout:Ot},Qt={2:bt,3:wt,4:xt,5:Ct},Wt="pointerdown",$t="pointermove pointerup pointercancel";t.MSPointerEvent&&(Wt="MSPointerDown",$t="MSPointerMove MSPointerUp MSPointerCancel"),c(H,T,{handler:function(t){var e=this.store,i=!1,n=t.type.toLowerCase().replace("ms",""),a=Ft[n],o=Qt[t.pointerType]||t.pointerType,r=o==bt,s=y(e,t.pointerId,"pointerId");a&Tt&&(0===t.button||r)?0>s&&(e.push(t),s=e.length-1):a&(Pt|Ot)&&(i=!0),0>s||(e[s]=t,this.callback(this.manager,a,{pointers:e,changedPointers:[t],pointerType:o,srcEvent:t}),i&&e.splice(s,1))}});var Rt={touchstart:Tt,touchmove:St,touchend:Pt,touchcancel:Ot},Xt="touchstart",Yt="touchstart touchmove touchend touchcancel";c(N,T,{handler:function(t){var e=Rt[t.type];if(e===Tt&&(this.started=!0),this.started){var i=F.call(this,t,e);e&(Pt|Ot)&&0===i[0].length-i[1].length&&(this.started=!1),this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:bt,srcEvent:t})}}});var Bt={touchstart:Tt,touchmove:St,touchend:Pt,touchcancel:Ot},Ut="touchstart touchmove touchend touchcancel";c(Q,T,{handler:function(t){var e=Bt[t.type],i=W.call(this,t,e);i&&this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:bt,srcEvent:t})}}),c($,T,{handler:function(t,e,i){var n=i.pointerType==bt,a=i.pointerType==xt;if(n)this.mouse.allow=!1;else if(a&&!this.mouse.allow)return;e&(Pt|Ot)&&(this.mouse.allow=!0),this.callback(t,e,i)},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Gt=x(ct.style,"touchAction"),Zt=Gt!==n,Jt="compute",Kt="auto",te="manipulation",ee="none",ie="pan-x",ne="pan-y";R.prototype={set:function(t){t==Jt&&(t=this.compute()),Zt&&(this.manager.element.style[Gt]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return r(this.manager.recognizers,function(e){d(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))}),X(t.join(" "))},preventDefaults:function(t){if(!Zt){var e=t.srcEvent,i=t.offsetDirection;if(this.manager.session.prevented)return void e.preventDefault();var n=this.actions,a=g(n,ee),o=g(n,ne),r=g(n,ie);return a||o&&i&qt||r&&i&Vt?this.preventSrc(e):void 0}},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var ae=1,oe=2,re=4,se=8,le=se,ce=16,ue=32;Y.prototype={defaults:{},set:function(t){return s(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(o(t,"recognizeWith",this))return this;var e=this.simultaneous;return t=G(t,this),e[t.id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return o(t,"dropRecognizeWith",this)?this:(t=G(t,this),delete this.simultaneous[t.id],this)},requireFailure:function(t){if(o(t,"requireFailure",this))return this;var e=this.requireFail;return t=G(t,this),-1===y(e,t)&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(o(t,"dropRequireFailure",this))return this;t=G(t,this);var e=y(this.requireFail,t);return e>-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){function e(e){i.manager.emit(i.options.event+(e?B(n):""),t)}var i=this,n=this.state;se>n&&e(!0),e(),n>=se&&e(!0)},tryEmit:function(t){return this.canEmit()?this.emit(t):void(this.state=ue)},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(this.requireFail[t].state&(ue|ae)))return!1;t++}return!0},recognize:function(t){var e=s({},t);return d(this.options.enable,[this,e])?(this.state&(le|ce|ue)&&(this.state=ae),this.state=this.process(e),void(this.state&(oe|re|se|ce)&&this.tryEmit(e))):(this.reset(),void(this.state=ue))},process:function(){},getTouchAction:function(){},reset:function(){}},c(Z,Y,{defaults:{pointers:1},attrTest:function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},process:function(t){var e=this.state,i=t.eventType,n=e&(oe|re),a=this.attrTest(t);return n&&(i&Ot||!a)?e|ce:n||a?i&Pt?e|se:e&oe?e|re:oe:ue}}),c(J,Z,{defaults:{event:"pan",threshold:10,pointers:1,direction:jt},getTouchAction:function(){var t=this.options.direction,e=[];return t&qt&&e.push(ne),t&Vt&&e.push(ie),e},directionTest:function(t){var e=this.options,i=!0,n=t.distance,a=t.direction,o=t.deltaX,r=t.deltaY;return a&e.direction||(e.direction&qt?(a=0===o?Et:0>o?It:At,i=o!=this.pX,n=Math.abs(t.deltaX)):(a=0===r?Et:0>r?Mt:_t,i=r!=this.pY,n=Math.abs(t.deltaY))),t.direction=a,i&&n>e.threshold&&a&e.direction},attrTest:function(t){return Z.prototype.attrTest.call(this,t)&&(this.state&oe||!(this.state&oe)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=U(t.direction);e&&this.manager.emit(this.options.event+e,t),this._super.emit.call(this,t)}}),c(K,Z,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[ee]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||this.state&oe)},emit:function(t){if(this._super.emit.call(this,t),1!==t.scale){var e=t.scale<1?"in":"out";this.manager.emit(this.options.event+e,t)}}}),c(tt,Y,{defaults:{event:"press",pointers:1,time:500,threshold:5},getTouchAction:function(){return[Kt]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,n=t.distance<e.threshold,o=t.deltaTime>e.time;if(this._input=t,!n||!i||t.eventType&(Pt|Ot)&&!o)this.reset();else if(t.eventType&Tt)this.reset(),this._timer=a(function(){this.state=le,this.tryEmit()},e.time,this);else if(t.eventType&Pt)return le;return ue},reset:function(){clearTimeout(this._timer)},emit:function(t){this.state===le&&(t&&t.eventType&Pt?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=ft(),this.manager.emit(this.options.event,this._input)))}}),c(et,Z,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[ee]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||this.state&oe)}}),c(it,Z,{defaults:{event:"swipe",threshold:10,velocity:.65,direction:qt|Vt,pointers:1},getTouchAction:function(){return J.prototype.getTouchAction.call(this)},attrTest:function(t){var e,i=this.options.direction;return i&(qt|Vt)?e=t.velocity:i&qt?e=t.velocityX:i&Vt&&(e=t.velocityY),this._super.attrTest.call(this,t)&&i&t.direction&&t.distance>this.options.threshold&&pt(e)>this.options.velocity&&t.eventType&Pt},emit:function(t){var e=U(t.direction);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),c(nt,Y,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:2,posThreshold:10},getTouchAction:function(){return[te]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,n=t.distance<e.threshold,o=t.deltaTime<e.time;if(this.reset(),t.eventType&Tt&&0===this.count)return this.failTimeout();if(n&&o&&i){if(t.eventType!=Pt)return this.failTimeout();var r=!this.pTime||t.timeStamp-this.pTime<e.interval,s=!this.pCenter||V(this.pCenter,t.center)<e.posThreshold;this.pTime=t.timeStamp,this.pCenter=t.center,s&&r?this.count+=1:this.count=1,this._input=t;var l=this.count%e.taps;if(0===l)return this.hasRequireFailures()?(this._timer=a(function(){this.state=le,this.tryEmit()},e.interval,this),oe):le}return ue},failTimeout:function(){return this._timer=a(function(){this.state=ue},this.options.interval,this),ue},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==le&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),at.VERSION="2.0.4",at.defaults={domEvents:!1,touchAction:Jt,enable:!0,inputTarget:null,inputClass:null,preset:[[et,{enable:!1}],[K,{enable:!1},["rotate"]],[it,{direction:qt}],[J,{direction:qt},["swipe"]],[nt],[nt,{event:"doubletap",taps:2},["tap"]],[tt]],cssProps:{userSelect:"default",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var de=1,pe=2;ot.prototype={set:function(t){return s(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},stop:function(t){this.session.stopped=t?pe:de},recognize:function(t){var e=this.session;if(!e.stopped){this.touchAction.preventDefaults(t);var i,n=this.recognizers,a=e.curRecognizer;(!a||a&&a.state&le)&&(a=e.curRecognizer=null);for(var o=0;o<n.length;)i=n[o],e.stopped===pe||a&&i!=a&&!i.canRecognizeWith(a)?i.reset():i.recognize(t),!a&&i.state&(oe|re|se)&&(a=e.curRecognizer=i),o++}},get:function(t){if(t instanceof Y)return t;for(var e=this.recognizers,i=0;i<e.length;i++)if(e[i].options.event==t)return e[i];return null},add:function(t){if(o(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t},remove:function(t){if(o(t,"remove",this))return this;var e=this.recognizers;return t=this.get(t),e.splice(y(e,t),1),this.touchAction.update(),this},on:function(t,e){var i=this.handlers;return r(m(t),function(t){i[t]=i[t]||[],i[t].push(e)}),this},off:function(t,e){var i=this.handlers;return r(m(t),function(t){e?i[t].splice(y(i[t],e),1):delete i[t]}),this},emit:function(t,e){this.options.domEvents&&st(t,e);var i=this.handlers[t]&&this.handlers[t].slice();if(i&&i.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var n=0;n<i.length;)i[n](e),n++}},destroy:function(){this.element&&rt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},s(at,{INPUT_START:Tt,INPUT_MOVE:St,INPUT_END:Pt,INPUT_CANCEL:Ot,STATE_POSSIBLE:ae,STATE_BEGAN:oe,STATE_CHANGED:re,STATE_ENDED:se,STATE_RECOGNIZED:le,STATE_CANCELLED:ce,STATE_FAILED:ue,DIRECTION_NONE:Et,DIRECTION_LEFT:It,DIRECTION_RIGHT:At,DIRECTION_UP:Mt,DIRECTION_DOWN:_t,DIRECTION_HORIZONTAL:qt,DIRECTION_VERTICAL:Vt,DIRECTION_ALL:jt,Manager:ot,Input:T,TouchAction:R,TouchInput:Q,MouseInput:L,PointerEventInput:H,TouchMouseInput:$,SingleTouchInput:N,Recognizer:Y,AttrRecognizer:Z,Tap:nt,Pan:J,Swipe:it,Pinch:K,Rotate:et,Press:tt,on:f,off:h,each:r,merge:l,extend:s,inherit:c,bindFn:u,prefixed:x}),typeof define==ut&&define.amd?define(function(){return at}):"undefined"!=typeof module&&module.exports?module.exports=at:t[i]=at}(window,document,"Hammer"),function(t){"function"==typeof define&&define.amd?define(["jquery","hammerjs"],t):"object"==typeof exports?t(require("jquery"),require("hammerjs")):t(jQuery,Hammer)}(function(t,e){function i(i,n){var a=t(i);a.data("hammer")||a.data("hammer",new e(a[0],n))}t.fn.hammer=function(t){return this.each(function(){i(this,t)})},e.Manager.prototype.emit=function(e){return function(i,n){e.call(this,i,n),t(this.element).trigger({type:i,gesture:n})}}(e.Manager.prototype.emit)}),function(t){t.Package?Materialize={}:t.Materialize={}}(window),/*
 * raf.js
 * https://github.com/ngryman/raf.js
 *
 * original requestAnimationFrame polyfill by Erik Möller
 * inspired from paul_irish gist and post
 *
 * Copyright (c) 2013 ngryman
 * Licensed under the MIT license.
 */
function(t){for(var e=0,i=["webkit","moz"],n=t.requestAnimationFrame,a=t.cancelAnimationFrame,o=i.length;--o>=0&&!n;)n=t[i[o]+"RequestAnimationFrame"],a=t[i[o]+"CancelRequestAnimationFrame"];n&&a||(n=function(t){var i=+Date.now(),n=Math.max(e+16,i);return setTimeout(function(){t(e=n)},n-i)},a=clearTimeout),t.requestAnimationFrame=n,t.cancelAnimationFrame=a}(window),Materialize.guid=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return function(){return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}}(),Materialize.escapeHash=function(t){return t.replace(/(:|\.|\[|\]|,|=)/g,"\\$1")},Materialize.elementOrParentIsFixed=function(t){var e=$(t),i=e.add(e.parents()),n=!1;return i.each(function(){if("fixed"===$(this).css("position"))return n=!0,!1}),n};var Vel;Vel=jQuery?jQuery.Velocity:$?$.Velocity:Velocity,function(t){t.fn.collapsible=function(e){var i={accordion:void 0,onOpen:void 0,onClose:void 0};return e=t.extend(i,e),this.each(function(){function i(e){c=l.find("> li > .collapsible-header"),e.hasClass("active")?e.parent().addClass("active"):e.parent().removeClass("active"),e.parent().hasClass("active")?e.siblings(".collapsible-body").stop(!0,!1).slideDown({duration:350,easing:"easeOutQuart",queue:!1,complete:function(){t(this).css("height","")}}):e.siblings(".collapsible-body").stop(!0,!1).slideUp({duration:350,easing:"easeOutQuart",queue:!1,complete:function(){t(this).css("height","")}}),c.not(e).removeClass("active").parent().removeClass("active"),c.not(e).parent().children(".collapsible-body").stop(!0,!1).each(function(){t(this).is(":visible")&&t(this).slideUp({duration:350,easing:"easeOutQuart",queue:!1,complete:function(){t(this).css("height",""),o(t(this).siblings(".collapsible-header"))}})})}function n(e){e.hasClass("active")?e.parent().addClass("active"):e.parent().removeClass("active"),e.parent().hasClass("active")?e.siblings(".collapsible-body").stop(!0,!1).slideDown({duration:350,easing:"easeOutQuart",queue:!1,complete:function(){t(this).css("height","")}}):e.siblings(".collapsible-body").stop(!0,!1).slideUp({duration:350,easing:"easeOutQuart",queue:!1,complete:function(){t(this).css("height","")}})}function a(t){e.accordion||"accordion"===u||void 0===u?i(t):n(t),o(t)}function o(t){t.hasClass("active")?"function"==typeof e.onOpen&&e.onOpen.call(this,t.parent()):"function"==typeof e.onClose&&e.onClose.call(this,t.parent())}function r(t){var e=s(t);return e.length>0}function s(t){return t.closest("li > .collapsible-header")}var l=t(this),c=t(this).find("> li > .collapsible-header"),u=l.data("collapsible");l.off("click.collapse","> li > .collapsible-header"),c.off("click.collapse"),l.on("click.collapse","> li > .collapsible-header",function(e){var i=t(e.target);r(i)&&(i=s(i)),i.toggleClass("active"),a(i)}),e.accordion||"accordion"===u||void 0===u?a(c.filter(".active").first()):c.filter(".active").each(function(){a(t(this))})})},t(document).ready(function(){t(".collapsible").collapsible()})}(jQuery),function(t){t.fn.scrollTo=function(e){return t(this).scrollTop(t(this).scrollTop()-t(this).offset().top+t(e).offset().top),this},t.fn.dropdown=function(e){var i={inDuration:300,outDuration:225,constrain_width:!0,hover:!1,gutter:0,belowOrigin:!1,alignment:"left",stopPropagation:!1};return"open"===e?(this.each(function(){t(this).trigger("open")}),!1):"close"===e?(this.each(function(){t(this).trigger("close")}),!1):void this.each(function(){function n(){void 0!==r.data("induration")&&(s.inDuration=r.data("induration")),void 0!==r.data("outduration")&&(s.outDuration=r.data("outduration")),void 0!==r.data("constrainwidth")&&(s.constrain_width=r.data("constrainwidth")),void 0!==r.data("hover")&&(s.hover=r.data("hover")),void 0!==r.data("gutter")&&(s.gutter=r.data("gutter")),void 0!==r.data("beloworigin")&&(s.belowOrigin=r.data("beloworigin")),void 0!==r.data("alignment")&&(s.alignment=r.data("alignment")),void 0!==r.data("stoppropagation")&&(s.stopPropagation=r.data("stoppropagation"))}function a(e){"focus"===e&&(l=!0),n(),c.addClass("active"),r.addClass("active"),s.constrain_width===!0?c.css("width",r.outerWidth()):c.css("white-space","nowrap");var i=window.innerHeight,a=r.innerHeight(),o=r.offset().left,u=r.offset().top-t(window).scrollTop(),d=s.alignment,p=0,f=0,h=0;s.belowOrigin===!0&&(h=a);var v=0,g=0,m=r.parent();if(m.is("body")||(m[0].scrollHeight>m[0].clientHeight&&(v=m[0].scrollTop),m[0].scrollWidth>m[0].clientWidth&&(g=m[0].scrollLeft)),o+c.innerWidth()>t(window).width()?d="right":o-c.innerWidth()+r.innerWidth()<0&&(d="left"),u+c.innerHeight()>i)if(u+a-c.innerHeight()<0){var y=i-u-h;c.css("max-height",y)}else h||(h+=a),h-=c.innerHeight();if("left"===d)p=s.gutter,f=r.position().left+p;else if("right"===d){var b=r.position().left+r.outerWidth()-c.outerWidth();p=-s.gutter,f=b+p}c.css({position:"absolute",top:r.position().top+h+v,left:f+g}),c.stop(!0,!0).css("opacity",0).slideDown({queue:!1,duration:s.inDuration,easing:"easeOutCubic",complete:function(){t(this).css("height","")}}).animate({opacity:1},{queue:!1,duration:s.inDuration,easing:"easeOutSine"})}function o(){l=!1,c.fadeOut(s.outDuration),c.removeClass("active"),r.removeClass("active"),setTimeout(function(){c.css("max-height","")},s.outDuration)}var r=t(this),s=t.extend({},i,e),l=!1,c=t("#"+r.attr("data-activates"));if(n(),r.after(c),s.hover){var u=!1;r.unbind("click."+r.attr("id")),r.on("mouseenter",function(t){u===!1&&(a(),u=!0)}),r.on("mouseleave",function(e){var i=e.toElement||e.relatedTarget;t(i).closest(".dropdown-content").is(c)||(c.stop(!0,!0),o(),u=!1)}),c.on("mouseleave",function(e){var i=e.toElement||e.relatedTarget;t(i).closest(".dropdown-button").is(r)||(c.stop(!0,!0),o(),u=!1)})}else r.unbind("click."+r.attr("id")),r.bind("click."+r.attr("id"),function(e){l||(r[0]!=e.currentTarget||r.hasClass("active")||0!==t(e.target).closest(".dropdown-content").length?r.hasClass("active")&&(o(),t(document).unbind("click."+c.attr("id")+" touchstart."+c.attr("id"))):(e.preventDefault(),s.stopPropagation&&e.stopPropagation(),a("click")),c.hasClass("active")&&t(document).bind("click."+c.attr("id")+" touchstart."+c.attr("id"),function(e){c.is(e.target)||r.is(e.target)||r.find(e.target).length||(o(),t(document).unbind("click."+c.attr("id")+" touchstart."+c.attr("id")))}))});r.on("open",function(t,e){a(e)}),r.on("close",o)})},t(document).ready(function(){t(".dropdown-button").dropdown()})}(jQuery),function(t){var e=0,i=0,n=function(){return i++,"materialize-modal-overlay-"+i},a={init:function(i){var a={opacity:.5,in_duration:350,out_duration:250,ready:void 0,complete:void 0,dismissible:!0,starting_top:"4%",ending_top:"10%"};return i=t.extend(a,i),this.each(function(){var a=t(this),o=t(this).attr("id")||"#"+t(this).data("target"),r=function(){var n=a.data("overlay-id"),o=t("#"+n);a.removeClass("open"),t("body").css({overflow:"",width:""}),a.find(".modal-close").off("click.close"),t(document).off("keyup.modal"+n),o.velocity({opacity:0},{duration:i.out_duration,queue:!1,ease:"easeOutQuart"});var r={duration:i.out_duration,queue:!1,ease:"easeOutCubic",complete:function(){t(this).css({display:"none"}),"function"==typeof i.complete&&i.complete.call(this,a),o.remove(),e--}};a.hasClass("bottom-sheet")?a.velocity({bottom:"-100%",opacity:0},r):a.velocity({top:i.starting_top,opacity:0,scaleX:.7},r)},s=function(o){var s=t("body"),l=s.innerWidth();if(s.css("overflow","hidden"),s.width(l),!a.hasClass("open")){var c=n(),u=t('<div class="modal-overlay"></div>');lStack=++e,u.attr("id",c).css("z-index",1e3+2*lStack),a.data("overlay-id",c).css("z-index",1e3+2*lStack+1),a.addClass("open"),t("body").append(u),i.dismissible&&(u.click(function(){r()}),t(document).on("keyup.modal"+c,function(t){27===t.keyCode&&r()})),a.find(".modal-close").on("click.close",function(t){r()}),u.css({display:"block",opacity:0}),a.css({display:"block",opacity:0}),u.velocity({opacity:i.opacity},{duration:i.in_duration,queue:!1,ease:"easeOutCubic"}),a.data("associated-overlay",u[0]);var d={duration:i.in_duration,queue:!1,ease:"easeOutCubic",complete:function(){"function"==typeof i.ready&&i.ready.call(this,a,o)}};a.hasClass("bottom-sheet")?a.velocity({bottom:"0",opacity:1},d):(t.Velocity.hook(a,"scaleX",.7),a.css({top:i.starting_top}),a.velocity({top:i.ending_top,opacity:1,scaleX:"1"},d))}};t(document).off("click.modalTrigger",'a[href="#'+o+'"], [data-target="'+o+'"]'),t(this).off("openModal"),t(this).off("closeModal"),t(document).on("click.modalTrigger",'a[href="#'+o+'"], [data-target="'+o+'"]',function(e){i.starting_top=(t(this).offset().top-t(window).scrollTop())/1.15,s(t(this)),e.preventDefault()}),t(this).on("openModal",function(){t(this).attr("href")||"#"+t(this).data("target");s()}),t(this).on("closeModal",function(){r()})})},open:function(){t(this).trigger("openModal")},close:function(){t(this).trigger("closeModal")}};t.fn.modal=function(e){return a[e]?a[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void t.error("Method "+e+" does not exist on jQuery.modal"):a.init.apply(this,arguments)}}(jQuery),function(t){t.fn.materialbox=function(){return this.each(function(){function e(){o=!1;var e=l.parent(".material-placeholder"),n=(window.innerWidth,window.innerHeight,l.data("width")),r=l.data("height");l.velocity("stop",!0),t("#materialbox-overlay").velocity("stop",!0),t(".materialbox-caption").velocity("stop",!0),t("#materialbox-overlay").velocity({opacity:0},{duration:s,queue:!1,easing:"easeOutQuad",complete:function(){a=!1,t(this).remove()}}),l.velocity({width:n,height:r,left:0,top:0},{duration:s,queue:!1,easing:"easeOutQuad"}),t(".materialbox-caption").velocity({opacity:0},{duration:s,queue:!1,easing:"easeOutQuad",complete:function(){e.css({height:"",width:"",position:"",top:"",left:""}),l.css({height:"",top:"",left:"",width:"","max-width":"",position:"","z-index":""}),l.removeClass("active"),o=!0,t(this).remove(),i&&i.css("overflow","")}})}if(!t(this).hasClass("initialized")){t(this).addClass("initialized");var i,n,a=!1,o=!0,r=275,s=200,l=t(this),c=t("<div></div>").addClass("material-placeholder");l.wrap(c),l.on("click",function(){var s=l.parent(".material-placeholder"),c=window.innerWidth,u=window.innerHeight,d=l.width(),p=l.height();if(o===!1)return e(),!1;if(a&&o===!0)return e(),!1;o=!1,l.addClass("active"),a=!0,s.css({width:s[0].getBoundingClientRect().width,height:s[0].getBoundingClientRect().height,position:"relative",top:0,left:0}),i=void 0,n=s[0].parentNode;for(;null!==n&&!t(n).is(document);){var f=t(n);"visible"!==f.css("overflow")&&(f.css("overflow","visible"),i=void 0===i?f:i.add(f)),n=n.parentNode}l.css({position:"absolute","z-index":1e3}).data("width",d).data("height",p);var h=t('<div id="materialbox-overlay"></div>').css({opacity:0}).click(function(){o===!0&&e()});if(l.before(h),h.velocity({opacity:1},{duration:r,queue:!1,easing:"easeOutQuad"}),""!==l.data("caption")){var v=t('<div class="materialbox-caption"></div>');v.text(l.data("caption")),t("body").append(v),v.css({display:"inline"}),v.velocity({opacity:1},{duration:r,queue:!1,easing:"easeOutQuad"})}var g=0,m=d/c,y=p/u,b=0,w=0;m>y?(g=p/d,b=.9*c,w=.9*c*g):(g=d/p,b=.9*u*g,w=.9*u),l.hasClass("responsive-img")?l.velocity({"max-width":b,width:d},{duration:0,queue:!1,complete:function(){l.css({left:0,top:0}).velocity({height:w,width:b,left:t(document).scrollLeft()+c/2-l.parent(".material-placeholder").offset().left-b/2,top:t(document).scrollTop()+u/2-l.parent(".material-placeholder").offset().top-w/2},{duration:r,queue:!1,easing:"easeOutQuad",complete:function(){o=!0}})}}):l.css("left",0).css("top",0).velocity({height:w,width:b,left:t(document).scrollLeft()+c/2-l.parent(".material-placeholder").offset().left-b/2,top:t(document).scrollTop()+u/2-l.parent(".material-placeholder").offset().top-w/2},{duration:r,queue:!1,easing:"easeOutQuad",complete:function(){o=!0}})}),t(window).scroll(function(){a&&e()}),t(document).keyup(function(t){27===t.keyCode&&o===!0&&a&&e()})}})},t(document).ready(function(){t(".materialboxed").materialbox()})}(jQuery),function(t){t.fn.parallax=function(){var e=t(window).width();return this.each(function(i){function n(i){var n;n=e<601?a.height()>0?a.height():a.children("img").height():a.height()>0?a.height():500;var o=a.children("img").first(),r=o.height(),s=r-n,l=a.offset().top+n,c=a.offset().top,u=t(window).scrollTop(),d=window.innerHeight,p=u+d,f=(p-c)/(n+d),h=Math.round(s*f);i&&o.css("display","block"),l>u&&c<u+d&&o.css("transform","translate3D(-50%,"+h+"px, 0)")}var a=t(this);a.addClass("parallax"),a.children("img").one("load",function(){n(!0)}).each(function(){this.complete&&t(this).trigger("load")}),t(window).scroll(function(){e=t(window).width(),n(!1)}),t(window).resize(function(){e=t(window).width(),n(!1)})})}}(jQuery),function(t){var e={init:function(e){var i={onShow:null};return e=t.extend(i,e),this.each(function(){var i,n,a=t(this),o=(t(window).width(),a.find("li.tab a")),r=a.width(),s=Math.max(r,a[0].scrollWidth)/o.length,l=0,c=function(t){return r-t.position().left-t.outerWidth()-a.scrollLeft()},u=function(t){return t.position().left+a.scrollLeft()};i=t(o.filter('[href="'+location.hash+'"]')),0===i.length&&(i=t(this).find("li.tab a.active").first()),0===i.length&&(i=t(this).find("li.tab a").first()),i.addClass("active"),l=o.index(i),l<0&&(l=0),void 0!==i[0]&&(n=t(i[0].hash)),a.append('<div class="indicator"></div>');var d=a.find(".indicator");a.is(":visible")&&setTimeout(function(){d.css({right:c(i)}),d.css({left:u(i)})},0),t(window).resize(function(){r=a.width(),s=Math.max(r,a[0].scrollWidth)/o.length,l<0&&(l=0),0!==s&&0!==r&&(d.css({right:c(i)}),d.css({left:u(i)}))}),o.not(i).each(function(){t(Materialize.escapeHash(this.hash)).hide()}),a.on("click","a",function(p){if(t(this).parent().hasClass("disabled"))return void p.preventDefault();if(!t(this).attr("target")){r=a.width(),s=Math.max(r,a[0].scrollWidth)/o.length,i.removeClass("active"),void 0!==n&&n.hide(),i=t(this),n=t(Materialize.escapeHash(this.hash)),o=a.find("li.tab a");i.position();i.addClass("active");var f=l;l=o.index(t(this)),l<0&&(l=0),void 0!==n&&(n.show(),"function"==typeof e.onShow&&e.onShow.call(this,n)),l-f>=0?(d.velocity({right:c(i)},{duration:300,queue:!1,easing:"easeOutQuad"}),d.velocity({left:u(i)},{duration:300,queue:!1,easing:"easeOutQuad",delay:90})):(d.velocity({left:u(i)},{duration:300,queue:!1,easing:"easeOutQuad"}),d.velocity({right:c(i)},{duration:300,queue:!1,easing:"easeOutQuad",delay:90})),p.preventDefault()}})})},select_tab:function(t){this.find('a[href="#'+t+'"]').trigger("click")}};t.fn.tabs=function(i){return e[i]?e[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void t.error("Method "+i+" does not exist on jQuery.tabs"):e.init.apply(this,arguments)},t(document).ready(function(){t("ul.tabs").tabs()})}(jQuery),function(t){t.fn.tooltip=function(i){var n=5,a={delay:350,tooltip:"",position:"bottom",html:!1};return"remove"===i?(this.each(function(){t("#"+t(this).attr("data-tooltip-id")).remove(),t(this).off("mouseenter.tooltip mouseleave.tooltip")}),!1):(i=t.extend(a,i),this.each(function(){var a=Materialize.guid(),o=t(this);o.attr("data-tooltip-id")&&t("#"+o.attr("data-tooltip-id")).remove(),o.attr("data-tooltip-id",a);var r,s,l,c,u,d,p=function(){r=o.attr("data-html")?"true"===o.attr("data-html"):i.html,s=o.attr("data-delay"),s=void 0===s||""===s?i.delay:s,l=o.attr("data-position"),l=void 0===l||""===l?i.position:l,c=o.attr("data-tooltip"),c=void 0===c||""===c?i.tooltip:c};p();var f=function(){var e=t('<div class="material-tooltip"></div>');return c=r?t("<span></span>").html(c):t("<span></span>").text(c),e.append(c).appendTo(t("body")).attr("id",a),d=t('<div class="backdrop"></div>'),d.appendTo(e),e};u=f(),o.off("mouseenter.tooltip mouseleave.tooltip");var h,v=!1;o.on({"mouseenter.tooltip":function(t){var i=function(){p(),v=!0,u.velocity("stop"),d.velocity("stop"),u.css({display:"block",left:"0px",top:"0px"});var t,i,a,r=o.outerWidth(),s=o.outerHeight(),c=u.outerHeight(),f=u.outerWidth(),h="0px",g="0px",m=8,y=8;"top"===l?(t=o.offset().top-c-n,i=o.offset().left+r/2-f/2,a=e(i,t,f,c),h="-10px",d.css({bottom:0,left:0,borderRadius:"14px 14px 0 0",transformOrigin:"50% 100%",marginTop:c,marginLeft:f/2-d.width()/2})):"left"===l?(t=o.offset().top+s/2-c/2,i=o.offset().left-f-n,a=e(i,t,f,c),g="-10px",d.css({top:"-7px",right:0,width:"14px",height:"14px",borderRadius:"14px 0 0 14px",transformOrigin:"95% 50%",marginTop:c/2,marginLeft:f})):"right"===l?(t=o.offset().top+s/2-c/2,i=o.offset().left+r+n,a=e(i,t,f,c),g="+10px",d.css({top:"-7px",left:0,width:"14px",height:"14px",borderRadius:"0 14px 14px 0",transformOrigin:"5% 50%",marginTop:c/2,marginLeft:"0px"})):(t=o.offset().top+o.outerHeight()+n,i=o.offset().left+r/2-f/2,a=e(i,t,f,c),h="+10px",d.css({top:0,left:0,marginLeft:f/2-d.width()/2})),u.css({top:a.y,left:a.x}),m=Math.SQRT2*f/parseInt(d.css("width")),y=Math.SQRT2*c/parseInt(d.css("height")),u.velocity({marginTop:h,marginLeft:g},{duration:350,queue:!1}).velocity({opacity:1},{duration:300,delay:50,queue:!1}),d.css({display:"block"}).velocity({opacity:1},{duration:55,delay:0,queue:!1}).velocity({scaleX:m,scaleY:y},{duration:300,delay:0,queue:!1,easing:"easeInOutQuad"})};h=setTimeout(i,s)},"mouseleave.tooltip":function(){v=!1,clearTimeout(h),setTimeout(function(){v!==!0&&(u.velocity({opacity:0,marginTop:0,marginLeft:0},{duration:225,queue:!1}),d.velocity({opacity:0,scaleX:1,scaleY:1},{duration:225,queue:!1,complete:function(){d.css("display","none"),u.css("display","none"),v=!1}}))},225)}})}))};var e=function(e,i,n,a){var o=e,r=i;return o<0?o=4:o+n>window.innerWidth&&(o-=o+n-window.innerWidth),r<0?r=4:r+a>window.innerHeight+t(window).scrollTop&&(r-=r+a-window.innerHeight),{x:o,y:r}};t(document).ready(function(){t(".tooltipped").tooltip()})}(jQuery),function(t){"use strict";function e(t){return null!==t&&t===t.window}function i(t){return e(t)?t:9===t.nodeType&&t.defaultView}function n(t){var e,n,a={top:0,left:0},o=t&&t.ownerDocument;return e=o.documentElement,"undefined"!=typeof t.getBoundingClientRect&&(a=t.getBoundingClientRect()),n=i(o),{top:a.top+n.pageYOffset-e.clientTop,left:a.left+n.pageXOffset-e.clientLeft}}function a(t){var e="";for(var i in t)t.hasOwnProperty(i)&&(e+=i+":"+t[i]+";");return e}function o(t){if(u.allowEvent(t)===!1)return null;for(var e=null,i=t.target||t.srcElement;null!==i.parentElement;){if(!(i instanceof SVGElement||i.className.indexOf("waves-effect")===-1)){e=i;break}if(i.classList.contains("waves-effect")){e=i;break}i=i.parentElement}return e}function r(e){var i=o(e);null!==i&&(c.show(e,i),"ontouchstart"in t&&(i.addEventListener("touchend",c.hide,!1),i.addEventListener("touchcancel",c.hide,!1)),i.addEventListener("mouseup",c.hide,!1),i.addEventListener("mouseleave",c.hide,!1))}var s=s||{},l=document.querySelectorAll.bind(document),c={duration:750,show:function(t,e){if(2===t.button)return!1;var i=e||this,o=document.createElement("div");o.className="waves-ripple",i.appendChild(o);var r=n(i),s=t.pageY-r.top,l=t.pageX-r.left,u="scale("+i.clientWidth/100*10+")";"touches"in t&&(s=t.touches[0].pageY-r.top,l=t.touches[0].pageX-r.left),o.setAttribute("data-hold",Date.now()),o.setAttribute("data-scale",u),o.setAttribute("data-x",l),o.setAttribute("data-y",s);var d={top:s+"px",left:l+"px"};o.className=o.className+" waves-notransition",o.setAttribute("style",a(d)),o.className=o.className.replace("waves-notransition",""),d["-webkit-transform"]=u,d["-moz-transform"]=u,d["-ms-transform"]=u,d["-o-transform"]=u,d.transform=u,d.opacity="1",d["-webkit-transition-duration"]=c.duration+"ms",d["-moz-transition-duration"]=c.duration+"ms",d["-o-transition-duration"]=c.duration+"ms",d["transition-duration"]=c.duration+"ms",d["-webkit-transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",d["-moz-transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",d["-o-transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",d["transition-timing-function"]="cubic-bezier(0.250, 0.460, 0.450, 0.940)",o.setAttribute("style",a(d))},hide:function(t){u.touchup(t);var e=this,i=(1.4*e.clientWidth,null),n=e.getElementsByClassName("waves-ripple");if(!(n.length>0))return!1;i=n[n.length-1];var o=i.getAttribute("data-x"),r=i.getAttribute("data-y"),s=i.getAttribute("data-scale"),l=Date.now()-Number(i.getAttribute("data-hold")),d=350-l;d<0&&(d=0),setTimeout(function(){var t={top:r+"px",left:o+"px",opacity:"0","-webkit-transition-duration":c.duration+"ms","-moz-transition-duration":c.duration+"ms","-o-transition-duration":c.duration+"ms","transition-duration":c.duration+"ms","-webkit-transform":s,"-moz-transform":s,"-ms-transform":s,"-o-transform":s,transform:s};i.setAttribute("style",a(t)),setTimeout(function(){try{e.removeChild(i)}catch(t){return!1}},c.duration)},d)},wrapInput:function(t){for(var e=0;e<t.length;e++){var i=t[e];if("input"===i.tagName.toLowerCase()){var n=i.parentNode;if("i"===n.tagName.toLowerCase()&&n.className.indexOf("waves-effect")!==-1)continue;var a=document.createElement("i");a.className=i.className+" waves-input-wrapper";var o=i.getAttribute("style");o||(o=""),a.setAttribute("style",o),i.className="waves-button-input",i.removeAttribute("style"),n.replaceChild(a,i),a.appendChild(i)}}}},u={touches:0,allowEvent:function(t){var e=!0;return"touchstart"===t.type?u.touches+=1:"touchend"===t.type||"touchcancel"===t.type?setTimeout(function(){u.touches>0&&(u.touches-=1)},500):"mousedown"===t.type&&u.touches>0&&(e=!1),e},touchup:function(t){u.allowEvent(t)}};s.displayEffect=function(e){e=e||{},"duration"in e&&(c.duration=e.duration),c.wrapInput(l(".waves-effect")),"ontouchstart"in t&&document.body.addEventListener("touchstart",r,!1),document.body.addEventListener("mousedown",r,!1)},s.attach=function(e){"input"===e.tagName.toLowerCase()&&(c.wrapInput([e]),e=e.parentElement),"ontouchstart"in t&&e.addEventListener("touchstart",r,!1),e.addEventListener("mousedown",r,!1)},t.Waves=s,document.addEventListener("DOMContentLoaded",function(){s.displayEffect()},!1)}(window),Materialize.toast=function(t,e,i,n){function a(t){var e=document.createElement("div");if(e.classList.add("toast"),i)for(var a=i.split(" "),o=0,r=a.length;o<r;o++)e.classList.add(a[o]);("object"==typeof HTMLElement?t instanceof HTMLElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName)?e.appendChild(t):t instanceof jQuery?e.appendChild(t[0]):e.innerHTML=t;var s=new Hammer(e,{prevent_default:!1});return s.on("pan",function(t){var i=t.deltaX,n=80;e.classList.contains("panning")||e.classList.add("panning");var a=1-Math.abs(i/n);a<0&&(a=0),Vel(e,{left:i,opacity:a},{duration:50,queue:!1,easing:"easeOutQuad"})}),s.on("panend",function(t){var i=t.deltaX,a=80;Math.abs(i)>a?Vel(e,{marginTop:"-40px"},{duration:375,easing:"easeOutExpo",queue:!1,complete:function(){"function"==typeof n&&n(),e.parentNode.removeChild(e)}}):(e.classList.remove("panning"),Vel(e,{left:0,opacity:1},{duration:300,easing:"easeOutExpo",queue:!1}))}),e}i=i||"";var o=document.getElementById("toast-container");null===o&&(o=document.createElement("div"),o.id="toast-container",document.body.appendChild(o));var r=a(t);t&&o.appendChild(r),r.style.top="35px",r.style.opacity=0,Vel(r,{top:"0px",opacity:1},{duration:300,easing:"easeOutCubic",queue:!1});var s,l=e;null!=l&&(s=setInterval(function(){null===r.parentNode&&window.clearInterval(s),r.classList.contains("panning")||(l-=20),l<=0&&(Vel(r,{opacity:0,marginTop:"-40px"},{duration:375,easing:"easeOutExpo",queue:!1,complete:function(){"function"==typeof n&&n(),this[0].parentNode.removeChild(this[0])}}),window.clearInterval(s))},20))},function(t){var e={init:function(e){var i={menuWidth:300,edge:"left",closeOnClick:!1,draggable:!0};e=t.extend(i,e),t(this).each(function(){var i=t(this),n=t("#"+i.attr("data-activates"));300!=e.menuWidth&&n.css("width",e.menuWidth);var a;e.draggable?(a=t('<div class="drag-target"></div>').attr("data-sidenav",i.attr("data-activates")),t("body").append(a)):a=t(),"left"==e.edge?(n.css("transform","translateX(-100%)"),a.css({left:0})):(n.addClass("right-aligned").css("transform","translateX(100%)"),a.css({right:0})),n.hasClass("fixed")&&window.innerWidth>992&&n.css("transform","translateX(0)"),n.hasClass("fixed")&&t(window).resize(function(){window.innerWidth>992?0!==t("#sidenav-overlay").length&&s?o(!0):n.css("transform","translateX(0%)"):s===!1&&("left"===e.edge?n.css("transform","translateX(-100%)"):n.css("transform","translateX(100%)"))}),e.closeOnClick===!0&&n.on("click.itemclick","a:not(.collapsible-header)",function(){o()});var o=function(i){r=!1,s=!1,t("body").css({overflow:"",width:""}),t("#sidenav-overlay").velocity({opacity:0},{duration:200,queue:!1,easing:"easeOutQuad",complete:function(){t(this).remove()}}),"left"===e.edge?(a.css({width:"",right:"",left:"0"}),n.velocity({translateX:"-100%"},{duration:200,queue:!1,easing:"easeOutCubic",complete:function(){i===!0&&(n.removeAttr("style"),n.css("width",e.menuWidth))}})):(a.css({width:"",right:"0",left:""}),n.velocity({translateX:"100%"},{duration:200,queue:!1,easing:"easeOutCubic",complete:function(){i===!0&&(n.removeAttr("style"),n.css("width",e.menuWidth))}}))},r=!1,s=!1;e.draggable&&(a.on("click",function(){s&&o()}),a.hammer({prevent_default:!1}).bind("pan",function(i){if("touch"==i.gesture.pointerType){var a=(i.gesture.direction,i.gesture.center.x),r=(i.gesture.center.y,i.gesture.velocityX,t("body")),l=t("#sidenav-overlay"),c=r.innerWidth();if(r.css("overflow","hidden"),r.width(c),0===l.length&&(l=t('<div id="sidenav-overlay"></div>'),l.css("opacity",0).click(function(){o()}),t("body").append(l)),"left"===e.edge&&(a>e.menuWidth?a=e.menuWidth:a<0&&(a=0)),"left"===e.edge)a<e.menuWidth/2?s=!1:a>=e.menuWidth/2&&(s=!0),n.css("transform","translateX("+(a-e.menuWidth)+"px)");else{a<window.innerWidth-e.menuWidth/2?s=!0:a>=window.innerWidth-e.menuWidth/2&&(s=!1);var u=a-e.menuWidth/2;u<0&&(u=0),n.css("transform","translateX("+u+"px)")}var d;"left"===e.edge?(d=a/e.menuWidth,l.velocity({opacity:d},{duration:10,queue:!1,easing:"easeOutQuad"})):(d=Math.abs((a-window.innerWidth)/e.menuWidth),l.velocity({opacity:d},{duration:10,queue:!1,easing:"easeOutQuad"}))}}).bind("panend",function(i){if("touch"==i.gesture.pointerType){var o=t('<div id="sidenav-overlay"></div>'),l=i.gesture.velocityX,c=i.gesture.center.x,u=c-e.menuWidth,d=c-e.menuWidth/2;u>0&&(u=0),d<0&&(d=0),r=!1,"left"===e.edge?s&&l<=.3||l<-.5?(0!==u&&n.velocity({translateX:[0,u]},{duration:300,queue:!1,easing:"easeOutQuad"}),o.velocity({opacity:1},{duration:50,queue:!1,easing:"easeOutQuad"}),a.css({width:"50%",right:0,left:""}),s=!0):(!s||l>.3)&&(t("body").css({overflow:"",width:""}),n.velocity({translateX:[-1*e.menuWidth-10,u]},{duration:200,queue:!1,easing:"easeOutQuad"}),o.velocity({opacity:0},{duration:200,queue:!1,easing:"easeOutQuad",complete:function(){t(this).remove()}}),a.css({width:"10px",right:"",left:0})):s&&l>=-.3||l>.5?(0!==d&&n.velocity({translateX:[0,d]},{duration:300,queue:!1,easing:"easeOutQuad"}),o.velocity({opacity:1},{duration:50,queue:!1,easing:"easeOutQuad"}),a.css({width:"50%",right:"",left:0}),s=!0):(!s||l<-.3)&&(t("body").css({overflow:"",width:""}),n.velocity({translateX:[e.menuWidth+10,d]},{duration:200,queue:!1,easing:"easeOutQuad"}),o.velocity({opacity:0},{duration:200,queue:!1,easing:"easeOutQuad",complete:function(){t(this).remove()}}),a.css({width:"10px",right:0,left:""}))}})),i.click(function(){if(s===!0)s=!1,r=!1,o();else{var i=t("body"),l=t('<div id="sidenav-overlay"></div>'),c=i.innerWidth();i.css("overflow","hidden"),i.width(c),t("body").append(a),"left"===e.edge?(a.css({width:"50%",right:0,left:""}),n.velocity({translateX:[0,-1*e.menuWidth]},{duration:300,queue:!1,easing:"easeOutQuad"})):(a.css({width:"50%",right:"",left:0}),n.velocity({translateX:[0,e.menuWidth]},{duration:300,queue:!1,easing:"easeOutQuad"})),l.css("opacity",0).click(function(){s=!1,r=!1,o(),l.velocity({opacity:0},{duration:300,queue:!1,easing:"easeOutQuad",complete:function(){t(this).remove()}})}),t("body").append(l),l.velocity({opacity:1},{duration:300,queue:!1,easing:"easeOutQuad",complete:function(){s=!0,r=!1}})}return!1})})},destroy:function(){var e=t("#sidenav-overlay"),i=t('.drag-target[data-sidenav="'+t(this).attr("data-activates")+'"]');e.trigger("click"),i.remove(),t(this).off("click"),e.remove()},show:function(){this.trigger("click")},hide:function(){t("#sidenav-overlay").trigger("click")}};t.fn.sideNav=function(i){return e[i]?e[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void t.error("Method "+i+" does not exist on jQuery.sideNav"):e.init.apply(this,arguments)}}(jQuery),/**
 * Extend jquery with a scrollspy plugin.
 * This watches the window scroll and fires events when elements are scrolled into viewport.
 *
 * throttle() and getTime() taken from Underscore.js
 * https://github.com/jashkenas/underscore
 *
 * @author Copyright 2013 John Smart
 * @license https://raw.github.com/thesmart/jquery-scrollspy/master/LICENSE
 * @see https://github.com/thesmart
 * @version 0.1.2
 */
function(t){function e(e,i,n,a){var o=t();return t.each(r,function(t,r){if(r.height()>0){var s=r.offset().top,l=r.offset().left,c=l+r.width(),u=s+r.height(),d=!(l>i||c<a||s>n||u<e);d&&o.push(r)}}),o}function i(i){++c;var n=o.scrollTop(),a=o.scrollLeft(),r=a+o.width(),l=n+o.height(),d=e(n+u.top+i||200,r+u.right,l+u.bottom,a+u.left);t.each(d,function(t,e){var i=e.data("scrollSpy:ticks");"number"!=typeof i&&e.triggerHandler("scrollSpy:enter"),e.data("scrollSpy:ticks",c)}),t.each(s,function(t,e){var i=e.data("scrollSpy:ticks");"number"==typeof i&&i!==c&&(e.triggerHandler("scrollSpy:exit"),e.data("scrollSpy:ticks",null))}),s=d}function n(){o.trigger("scrollSpy:winSize")}/**
	 * Returns a function, that, when invoked, will only be triggered at most once
	 * during a given window of time. Normally, the throttled function will run
	 * as much as it can, without ever going more than once per `wait` duration;
	 * but if you'd like to disable the execution on the leading edge, pass
	 * `{leading: false}`. To disable execution on the trailing edge, ditto.
	 * @license https://raw.github.com/jashkenas/underscore/master/LICENSE
	 * @param {function} func
	 * @param {number} wait
	 * @param {Object=} options
	 * @returns {Function}
	 */
function a(t,e,i){var n,a,o,r=null,s=0;i||(i={});var l=function(){s=i.leading===!1?0:d(),r=null,o=t.apply(n,a),n=a=null};return function(){var c=d();s||i.leading!==!1||(s=c);var u=e-(c-s);return n=this,a=arguments,u<=0?(clearTimeout(r),r=null,s=c,o=t.apply(n,a),n=a=null):r||i.trailing===!1||(r=setTimeout(l,u)),o}}var o=t(window),r=[],s=[],l=!1,c=0,u={top:0,right:0,bottom:0,left:0},d=Date.now||function(){return(new Date).getTime()};t.scrollSpy=function(e,n){var s={throttle:100,scrollOffset:200};n=t.extend(s,n);var c=[];e=t(e),e.each(function(e,i){r.push(t(i)),t(i).data("scrollSpy:id",e),t('a[href="#'+t(i).attr("id")+'"]').click(function(e){e.preventDefault();var i=t(Materialize.escapeHash(this.hash)).offset().top+1;t("html, body").animate({scrollTop:i-n.scrollOffset},{duration:400,queue:!1,easing:"easeOutCubic"})})}),u.top=n.offsetTop||0,u.right=n.offsetRight||0,u.bottom=n.offsetBottom||0,u.left=n.offsetLeft||0;var d=a(function(){i(n.scrollOffset)},n.throttle||100),p=function(){t(document).ready(d)};return l||(o.on("scroll",p),o.on("resize",p),l=!0),setTimeout(p,0),e.on("scrollSpy:enter",function(){c=t.grep(c,function(t){return 0!=t.height()});var e=t(this);c[0]?(t('a[href="#'+c[0].attr("id")+'"]').removeClass("active"),e.data("scrollSpy:id")<c[0].data("scrollSpy:id")?c.unshift(t(this)):c.push(t(this))):c.push(t(this)),t('a[href="#'+c[0].attr("id")+'"]').addClass("active")}),e.on("scrollSpy:exit",function(){if(c=t.grep(c,function(t){return 0!=t.height()}),c[0]){t('a[href="#'+c[0].attr("id")+'"]').removeClass("active");var e=t(this);c=t.grep(c,function(t){return t.attr("id")!=e.attr("id")}),c[0]&&t('a[href="#'+c[0].attr("id")+'"]').addClass("active")}}),e},t.winSizeSpy=function(e){return t.winSizeSpy=function(){return o},e=e||{throttle:100},o.on("resize",a(n,e.throttle||100))},t.fn.scrollSpy=function(e){return t.scrollSpy(t(this),e)}}(jQuery),function(t){t(document).ready(function(){function e(e){var i=e.css("font-family"),n=e.css("font-size"),o=e.css("line-height");n&&a.css("font-size",n),i&&a.css("font-family",i),o&&a.css("line-height",o),"off"===e.attr("wrap")&&a.css("overflow-wrap","normal").css("white-space","pre"),a.text(e.val()+"\n");var r=a.html().replace(/\n/g,"<br>");a.html(r),e.is(":visible")?a.css("width",e.width()):a.css("width",t(window).width()/2),e.css("height",a.height())}Materialize.updateTextFields=function(){var e="input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea";t(e).each(function(e,i){t(i).val().length>0||i.autofocus||void 0!==t(this).attr("placeholder")||t(i)[0].validity.badInput===!0?t(this).siblings("label").addClass("active"):t(this).siblings("label").removeClass("active")})};var i="input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea";t(document).on("change",i,function(){0===t(this).val().length&&void 0===t(this).attr("placeholder")||t(this).siblings("label").addClass("active"),validate_field(t(this))}),t(document).ready(function(){Materialize.updateTextFields()}),t(document).on("reset",function(e){var n=t(e.target);n.is("form")&&(n.find(i).removeClass("valid").removeClass("invalid"),n.find(i).each(function(){""===t(this).attr("value")&&t(this).siblings("label").removeClass("active")}),n.find("select.initialized").each(function(){var t=n.find("option[selected]").text();n.siblings("input.select-dropdown").val(t)}))}),t(document).on("focus",i,function(){t(this).siblings("label, .prefix").addClass("active")}),t(document).on("blur",i,function(){var e=t(this),i=".prefix";0===e.val().length&&e[0].validity.badInput!==!0&&void 0===e.attr("placeholder")&&(i+=", label"),e.siblings(i).removeClass("active"),validate_field(e)}),window.validate_field=function(t){var e=void 0!==t.attr("length"),i=parseInt(t.attr("length")),n=t.val().length;0===t.val().length&&t[0].validity.badInput===!1?t.hasClass("validate")&&(t.removeClass("valid"),t.removeClass("invalid")):t.hasClass("validate")&&(t.is(":valid")&&e&&n<=i||t.is(":valid")&&!e?(t.removeClass("invalid"),t.addClass("valid")):(t.removeClass("valid"),t.addClass("invalid")))};var n="input[type=radio], input[type=checkbox]";t(document).on("keyup.radio",n,function(e){if(9===e.which){t(this).addClass("tabbed");var i=t(this);return void i.one("blur",function(e){t(this).removeClass("tabbed")})}});var a=t(".hiddendiv").first();a.length||(a=t('<div class="hiddendiv common"></div>'),t("body").append(a));var o=".materialize-textarea";t(o).each(function(){var i=t(this);i.val().length&&e(i)}),t("body").on("keyup keydown autoresize",o,function(){e(t(this))}),t(document).on("change",'.file-field input[type="file"]',function(){for(var e=t(this).closest(".file-field"),i=e.find("input.file-path"),n=t(this)[0].files,a=[],o=0;o<n.length;o++)a.push(n[o].name);i.val(a.join(", ")),i.trigger("change")});var r,s="input[type=range]",l=!1;t(s).each(function(){var e=t('<span class="thumb"><span class="value"></span></span>');t(this).after(e)});var c=".range-field";t(document).on("change",s,function(e){var i=t(this).siblings(".thumb");i.find(".value").html(t(this).val())}),t(document).on("input mousedown touchstart",s,function(e){var i=t(this).siblings(".thumb"),n=t(this).outerWidth();i.length<=0&&(i=t('<span class="thumb"><span class="value"></span></span>'),t(this).after(i)),i.find(".value").html(t(this).val()),l=!0,t(this).addClass("active"),i.hasClass("active")||i.velocity({height:"30px",width:"30px",top:"-20px",marginLeft:"-15px"},{duration:300,easing:"easeOutExpo"}),"input"!==e.type&&(r=void 0===e.pageX||null===e.pageX?e.originalEvent.touches[0].pageX-t(this).offset().left:e.pageX-t(this).offset().left,r<0?r=0:r>n&&(r=n),i.addClass("active").css("left",r)),i.find(".value").html(t(this).val())}),t(document).on("mouseup touchend",c,function(){l=!1,t(this).removeClass("active")}),t(document).on("mousemove touchmove",c,function(e){var i,n=t(this).children(".thumb");if(l){n.hasClass("active")||n.velocity({height:"30px",width:"30px",top:"-20px",marginLeft:"-15px"},{duration:300,easing:"easeOutExpo"}),i=void 0===e.pageX||null===e.pageX?e.originalEvent.touches[0].pageX-t(this).offset().left:e.pageX-t(this).offset().left;var a=t(this).outerWidth();i<0?i=0:i>a&&(i=a),n.addClass("active").css("left",i),n.find(".value").html(n.siblings(s).val())}}),t(document).on("mouseout touchleave",c,function(){if(!l){var e=t(this).children(".thumb");e.hasClass("active")&&e.velocity({height:"0",width:"0",top:"10px",marginLeft:"-6px"},{duration:100}),e.removeClass("active")}}),t.fn.autocomplete=function(e){var i={data:{}};return e=t.extend(i,e),this.each(function(){var i=t(this),n=e.data,a=i.closest(".input-field");if(!t.isEmptyObject(n)){var o=t('<ul class="autocomplete-content dropdown-content"></ul>');a.length?a.append(o):i.after(o);var r=function(t,e){var i=e.find("img"),n=e.text().toLowerCase().indexOf(""+t.toLowerCase()),a=n+t.length-1,o=e.text().slice(0,n),r=e.text().slice(n,a+1),s=e.text().slice(a+1);e.html("<span>"+o+"<span class='highlight'>"+r+"</span>"+s+"</span>"),i.length&&e.prepend(i)};i.on("keyup",function(e){if(13===e.which)return void o.find("li").first().click();var a=i.val().toLowerCase();if(o.empty(),""!==a)for(var s in n)if(n.hasOwnProperty(s)&&s.toLowerCase().indexOf(a)!==-1&&s.toLowerCase()!==a){var l=t("<li></li>");n[s]?l.append('<img src="'+n[s]+'" class="right circle"><span>'+s+"</span>"):l.append("<span>"+s+"</span>"),o.append(l),r(a,l)}}),o.on("click","li",function(){i.val(t(this).text().trim()),i.trigger("change"),o.empty()})}})}}),t.fn.material_select=function(e){function i(t,e,i){var a=t.indexOf(e),o=a===-1;return o?t.push(e):t.splice(a,1),i.siblings("ul.dropdown-content").find("li").eq(e).toggleClass("active"),i.find("option").eq(e).prop("selected",o),n(t,i),o}function n(t,e){for(var i="",n=0,a=t.length;n<a;n++){var o=e.find("option").eq(t[n]).text();i+=0===n?o:", "+o}""===i&&(i=e.find("option:disabled").eq(0).text()),e.siblings("input.select-dropdown").val(i)}t(this).each(function(){var n=t(this);if(!n.hasClass("browser-default")){var a=!!n.attr("multiple"),o=n.data("select-id");if(o&&(n.parent().find("span.caret").remove(),n.parent().find("input").remove(),n.unwrap(),t("ul#select-options-"+o).remove()),"destroy"===e)return void n.data("select-id",null).removeClass("initialized");var r=Materialize.guid();n.data("select-id",r);var s=t('<div class="select-wrapper"></div>');s.addClass(n.attr("class"));var l=t('<ul id="select-options-'+r+'" class="dropdown-content select-dropdown '+(a?"multiple-select-dropdown":"")+'"></ul>'),c=n.children("option, optgroup"),u=[],d=!1,p=n.find("option:selected").html()||n.find("option:first").html()||"",f=function(e,i,n){var a=i.is(":disabled")?"disabled ":"",o="optgroup-option"===n?"optgroup-option ":"",r=i.data("icon"),s=i.attr("class");if(r){var c="";return s&&(c=' class="'+s+'"'),"multiple"===n?l.append(t('<li class="'+a+'"><img alt="" src="'+r+'"'+c+'><span><input type="checkbox"'+a+"/><label></label>"+i.html()+"</span></li>")):l.append(t('<li class="'+a+o+'"><img alt="" src="'+r+'"'+c+"><span>"+i.html()+"</span></li>")),!0}"multiple"===n?l.append(t('<li class="'+a+'"><span><input type="checkbox"'+a+"/><label></label>"+i.html()+"</span></li>")):l.append(t('<li class="'+a+o+'"><span>'+i.html()+"</span></li>"))};c.length&&c.each(function(){if(t(this).is("option"))a?f(n,t(this),"multiple"):f(n,t(this));else if(t(this).is("optgroup")){var e=t(this).children("option");l.append(t('<li class="optgroup"><span>'+t(this).attr("label")+"</span></li>")),e.each(function(){f(n,t(this),"optgroup-option")})}}),l.find("li:not(.optgroup)").each(function(o){t(this).click(function(r){if(!t(this).hasClass("disabled")&&!t(this).hasClass("optgroup")){var s=!0;a?(t('input[type="checkbox"]',this).prop("checked",function(t,e){return!e}),s=i(u,t(this).index(),n),g.trigger("focus")):(l.find("li").removeClass("active"),t(this).toggleClass("active"),g.val(t(this).text())),m(l,t(this)),n.find("option").eq(o).prop("selected",s),n.trigger("change"),"undefined"!=typeof e&&e()}r.stopPropagation()})}),n.wrap(s);var h=t('<span class="caret">&#9660;</span>');n.is(":disabled")&&h.addClass("disabled");var v=p.replace(/"/g,"&quot;"),g=t('<input type="text" class="select-dropdown" readonly="true" '+(n.is(":disabled")?"disabled":"")+' data-activates="select-options-'+r+'" value="'+v+'"/>');n.before(g),g.before(h),g.after(l),n.is(":disabled")||g.dropdown({hover:!1,closeOnClick:!1}),n.attr("tabindex")&&t(g[0]).attr("tabindex",n.attr("tabindex")),n.addClass("initialized"),g.on({focus:function(){if(t("ul.select-dropdown").not(l[0]).is(":visible")&&t("input.select-dropdown").trigger("close"),!l.is(":visible")){t(this).trigger("open",["focus"]);var e=t(this).val(),i=l.find("li").filter(function(){return t(this).text().toLowerCase()===e.toLowerCase()})[0];m(l,i)}},click:function(t){t.stopPropagation()}}),g.on("blur",function(){a||t(this).trigger("close"),l.find("li.selected").removeClass("selected")}),l.hover(function(){d=!0},function(){d=!1}),t(window).on({click:function(){a&&(d||g.trigger("close"))}}),a&&n.find("option:selected:not(:disabled)").each(function(){var e=t(this).index();i(u,e,n),l.find("li").eq(e).find(":checkbox").prop("checked",!0)});var m=function(e,i){if(i){e.find("li.selected").removeClass("selected");var n=t(i);n.addClass("selected"),l.scrollTo(n)}},y=[],b=function(e){if(9==e.which)return void g.trigger("close");if(40==e.which&&!l.is(":visible"))return void g.trigger("open");if(13!=e.which||l.is(":visible")){e.preventDefault();var i=String.fromCharCode(e.which).toLowerCase(),n=[9,13,27,38,40];if(i&&n.indexOf(e.which)===-1){y.push(i);var o=y.join(""),r=l.find("li").filter(function(){return 0===t(this).text().toLowerCase().indexOf(o)})[0];r&&m(l,r)}if(13==e.which){var s=l.find("li.selected:not(.disabled)")[0];s&&(t(s).trigger("click"),a||g.trigger("close"))}40==e.which&&(r=l.find("li.selected").length?l.find("li.selected").next("li:not(.disabled)")[0]:l.find("li:not(.disabled)")[0],m(l,r)),27==e.which&&g.trigger("close"),38==e.which&&(r=l.find("li.selected").prev("li:not(.disabled)")[0],r&&m(l,r)),setTimeout(function(){y=[]},1e3)}};g.on("keydown",b)}})}}(jQuery),function(t){t(document).ready(function(){t(document).on("click.card",".card",function(e){t(this).find("> .card-reveal").length&&(t(e.target).is(t(".card-reveal .card-title"))||t(e.target).is(t(".card-reveal .card-title i"))?t(this).find(".card-reveal").velocity({translateY:0},{duration:225,queue:!1,easing:"easeInOutQuad",complete:function(){t(this).css({display:"none"})}}):(t(e.target).is(t(".card .activator"))||t(e.target).is(t(".card .activator i")))&&(t(e.target).closest(".card").css("overflow","hidden"),t(this).find(".card-reveal").css({display:"block"}).velocity("stop",!1).velocity({translateY:"-100%"},{duration:300,queue:!1,easing:"easeInOutQuad"})))})})}(jQuery),function(t){var e=!1,i={data:[],placeholder:"",secondaryPlaceholder:""};t(document).ready(function(){t(document).on("click",".chip .close",function(e){var i=t(this).closest(".chips");i.attr("data-initialized")||t(this).closest(".chip").remove()})}),t.fn.material_chip=function(n){var a=this;if(this.$el=t(this),this.$document=t(document),this.SELS={CHIPS:".chips",CHIP:".chip",INPUT:"input",DELETE:".material-icons",SELECTED_CHIP:".selected"},"data"===n)return this.$el.data("chips");var o=t.extend({},i,n);this.init=function(){var e=0;a.$el.each(function(){var i=t(this),n=Materialize.guid();o.data&&o.data instanceof Array||(o.data=[]),i.data("chips",o.data),i.attr("data-index",e),i.attr("data-initialized",!0),i.hasClass(a.SELS.CHIPS)||i.addClass("chips"),a.chips(i,n),e++})},this.handleEvents=function(){var e=a.SELS;a.$document.off("click.chips-focus",e.CHIPS).on("click.chips-focus",e.CHIPS,function(i){t(i.target).find(e.INPUT).focus()}),a.$document.off("click.chips-select",e.CHIP).on("click.chips-select",e.CHIP,function(i){t(e.CHIP).removeClass("selected"),t(this).toggleClass("selected")}),a.$document.off("keydown.chips").on("keydown.chips",function(i){if(!t(i.target).is("input, textarea")){var n,o=a.$document.find(e.CHIP+e.SELECTED_CHIP),r=o.closest(e.CHIPS),s=o.siblings(e.CHIP).length;if(o.length)if(8===i.which||46===i.which){i.preventDefault(),n=o.index(),a.deleteChip(n,r);var l=null;n+1<s?l=n:n!==s&&n+1!==s||(l=s-1),l<0&&(l=null),null!==l&&a.selectChip(l,r),s||r.find("input").focus()}else if(37===i.which){if(n=o.index()-1,n<0)return;t(e.CHIP).removeClass("selected"),a.selectChip(n,r)}else if(39===i.which){if(n=o.index()+1,t(e.CHIP).removeClass("selected"),n>s)return void r.find("input").focus();a.selectChip(n,r)}}}),a.$document.off("focusin.chips",e.CHIPS+" "+e.INPUT).on("focusin.chips",e.CHIPS+" "+e.INPUT,function(i){var n=t(i.target).closest(e.CHIPS);n.addClass("focus"),n.siblings("label, .prefix").addClass("active"),t(e.CHIP).removeClass("selected")}),a.$document.off("focusout.chips",e.CHIPS+" "+e.INPUT).on("focusout.chips",e.CHIPS+" "+e.INPUT,function(i){var n=t(i.target).closest(e.CHIPS);n.removeClass("focus"),n.data("chips").length||n.siblings("label").removeClass("active"),n.siblings(".prefix").removeClass("active")}),a.$document.off("keydown.chips-add",e.CHIPS+" "+e.INPUT).on("keydown.chips-add",e.CHIPS+" "+e.INPUT,function(i){var n=t(i.target),o=n.closest(e.CHIPS),r=o.children(e.CHIP).length;return 13===i.which?(i.preventDefault(),a.addChip({tag:n.val()},o),void n.val("")):8!==i.keyCode&&37!==i.keyCode||""!==n.val()||!r?void 0:(a.selectChip(r-1,o),void n.blur())}),a.$document.off("click.chips-delete",e.CHIPS+" "+e.DELETE).on("click.chips-delete",e.CHIPS+" "+e.DELETE,function(i){var n=t(i.target),o=n.closest(e.CHIPS),r=n.closest(e.CHIP);i.stopPropagation(),a.deleteChip(r.index(),o),o.find("input").focus()})},this.chips=function(t,e){var i="";t.data("chips").forEach(function(t){i+=a.renderChip(t)}),i+='<input id="'+e+'" class="input" placeholder="">',t.html(i),a.setPlaceholder(t);var n=t.next("label");n.length&&(n.attr("for",e),t.data("chips").length&&n.addClass("active"))},this.renderChip=function(t){if(t.tag){var e='<div class="chip">'+t.tag;return t.image&&(e+=' <img src="'+t.image+'"> '),e+='<i class="material-icons close">close</i>',e+="</div>"}},this.setPlaceholder=function(t){t.data("chips").length&&o.placeholder?t.find("input").prop("placeholder",o.placeholder):!t.data("chips").length&&o.secondaryPlaceholder&&t.find("input").prop("placeholder",o.secondaryPlaceholder)},this.isValid=function(t,e){for(var i=t.data("chips"),n=!1,a=0;a<i.length;a++)if(i[a].tag===e.tag)return void(n=!0);return""!==e.tag&&!n},this.addChip=function(e,i){if(a.isValid(i,e)){for(var n=a.renderChip(e),o=[],r=i.data("chips"),s=0;s<r.length;s++)o.push(r[s]);o.push(e),i.data("chips",o),t(n).insertBefore(i.find("input")),i.trigger("chip.add",e),a.setPlaceholder(i)}},this.deleteChip=function(t,e){var i=e.data("chips")[t];e.find(".chip").eq(t).remove();for(var n=[],o=e.data("chips"),r=0;r<o.length;r++)r!==t&&n.push(o[r]);e.data("chips",n),e.trigger("chip.delete",i),a.setPlaceholder(e)},this.selectChip=function(t,e){var i=e.find(".chip").eq(t);i&&!1===i.hasClass("selected")&&(i.addClass("selected"),e.trigger("chip.select",e.data("chips")[t]))},this.getChipsElement=function(t,e){return e.eq(t)},this.init(),e||(this.handleEvents(),e=!0)}}(jQuery),function(t){t.fn.pushpin=function(e){var i={top:0,bottom:1/0,offset:0};return"remove"===e?(this.each(function(){(id=t(this).data("pushpin-id"))&&(t(window).off("scroll."+id),t(this).removeData("pushpin-id").removeClass("pin-top pinned pin-bottom").removeAttr("style"))}),!1):(e=t.extend(i,e),$index=0,this.each(function(){function i(t){t.removeClass("pin-top"),t.removeClass("pinned"),t.removeClass("pin-bottom")}function n(n,a){n.each(function(){e.top<=a&&e.bottom>=a&&!t(this).hasClass("pinned")&&(i(t(this)),t(this).css("top",e.offset),t(this).addClass("pinned")),a<e.top&&!t(this).hasClass("pin-top")&&(i(t(this)),t(this).css("top",0),t(this).addClass("pin-top")),a>e.bottom&&!t(this).hasClass("pin-bottom")&&(i(t(this)),t(this).addClass("pin-bottom"),t(this).css("top",e.bottom-r))})}var a=Materialize.guid(),o=t(this),r=t(this).offset().top;t(this).data("pushpin-id",a),n(o,t(window).scrollTop()),t(window).on("scroll."+a,function(){var i=t(window).scrollTop()+e.offset;n(o,i)})}))}}(jQuery),function(t){t(document).ready(function(){t.fn.reverse=[].reverse,t(document).on("mouseenter.fixedActionBtn",".fixed-action-btn:not(.click-to-toggle):not(.toolbar)",function(i){var n=t(this);e(n)}),t(document).on("mouseleave.fixedActionBtn",".fixed-action-btn:not(.click-to-toggle):not(.toolbar)",function(e){var n=t(this);i(n)}),t(document).on("click.fabClickToggle",".fixed-action-btn.click-to-toggle > a",function(n){var a=t(this),o=a.parent();o.hasClass("active")?i(o):e(o)}),t(document).on("click.fabToolbar",".fixed-action-btn.toolbar > a",function(e){var i=t(this),a=i.parent();n(a)})}),t.fn.extend({openFAB:function(){e(t(this))},closeFAB:function(){i(t(this))},openToolbar:function(){n(t(this))},closeToolbar:function(){a(t(this))}});var e=function(e){var i=e;if(i.hasClass("active")===!1){var n,a,o=i.hasClass("horizontal");o===!0?a=40:n=40,i.addClass("active"),i.find("ul .btn-floating").velocity({scaleY:".4",scaleX:".4",translateY:n+"px",translateX:a+"px"},{duration:0});var r=0;i.find("ul .btn-floating").reverse().each(function(){t(this).velocity({opacity:"1",scaleX:"1",scaleY:"1",translateY:"0",translateX:"0"},{duration:80,delay:r}),r+=40})}},i=function(t){var e,i,n=t,a=n.hasClass("horizontal");a===!0?i=40:e=40,n.removeClass("active");n.find("ul .btn-floating").velocity("stop",!0),n.find("ul .btn-floating").velocity({opacity:"0",scaleX:".4",scaleY:".4",translateY:e+"px",translateX:i+"px"},{duration:80})},n=function(e){if("true"!==e.attr("data-open")){var i,n,o,r=window.innerWidth,s=window.innerHeight,l=e[0].getBoundingClientRect(),c=e.find("> a").first(),u=e.find("> ul").first(),d=t('<div class="fab-backdrop"></div>'),p=c.css("background-color");c.append(d),i=l.left-r/2+l.width/2,n=s-l.bottom,o=r/d.width(),e.attr("data-origin-bottom",l.bottom),e.attr("data-origin-left",l.left),e.attr("data-origin-width",l.width),e.addClass("active"),e.attr("data-open",!0),e.css({"text-align":"center",width:"100%",bottom:0,left:0,transform:"translateX("+i+"px)",transition:"none"}),c.css({transform:"translateY("+-n+"px)",transition:"none"}),d.css({"background-color":p}),setTimeout(function(){e.css({transform:"",transition:"transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s"}),c.css({overflow:"visible",transform:"",transition:"transform .2s"}),setTimeout(function(){e.css({overflow:"hidden","background-color":p}),d.css({transform:"scale("+o+")",transition:"transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)"}),u.find("> li > a").css({opacity:1}),t(window).on("scroll.fabToolbarClose",function(){a(e),t(window).off("scroll.fabToolbarClose"),t(document).off("click.fabToolbarClose")}),t(document).on("click.fabToolbarClose",function(i){t(i.target).closest(u).length||(a(e),t(window).off("scroll.fabToolbarClose"),t(document).off("click.fabToolbarClose"))})},100)},0)}},a=function(t){if("true"===t.attr("data-open")){var e,i,n,a=window.innerWidth,o=window.innerHeight,r=t.attr("data-origin-width"),s=t.attr("data-origin-bottom"),l=t.attr("data-origin-left"),c=t.find("> .btn-floating").first(),u=t.find("> ul").first(),d=t.find(".fab-backdrop"),p=c.css("background-color");e=l-a/2+r/2,i=o-s,n=a/d.width(),t.removeClass("active"),t.attr("data-open",!1),t.css({"background-color":"transparent",transition:"none"}),c.css({transition:"none"}),d.css({transform:"scale(0)","background-color":p}),u.find("> li > a").css({opacity:""}),setTimeout(function(){d.remove(),t.css({"text-align":"",width:"",bottom:"",left:"",overflow:"","background-color":"",transform:"translate3d("+-e+"px,0,0)"}),c.css({overflow:"",transform:"translate3d(0,"+i+"px,0)"}),setTimeout(function(){t.css({transform:"translate3d(0,0,0)",transition:"transform .2s"}),c.css({transform:"translate3d(0,0,0)",transition:"transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)"})},20)},200)}}}(jQuery),function(t){Materialize.fadeInImage=function(e){var i;if("string"==typeof e)i=t(e);else{if("object"!=typeof e)return;i=e}i.css({opacity:0}),t(i).velocity({opacity:1},{duration:650,queue:!1,easing:"easeOutSine"}),t(i).velocity({opacity:1},{duration:1300,queue:!1,easing:"swing",step:function(e,i){i.start=100;var n=e/100,a=150-(100-e)/1.75;a<100&&(a=100),e>=0&&t(this).css({"-webkit-filter":"grayscale("+n+")brightness("+a+"%)",filter:"grayscale("+n+")brightness("+a+"%)"})}})},Materialize.showStaggeredList=function(e){var i;if("string"==typeof e)i=t(e);else{if("object"!=typeof e)return;i=e}var n=0;i.find("li").velocity({translateX:"-100px"},{duration:0}),i.find("li").each(function(){t(this).velocity({opacity:"1",translateX:"0"},{duration:800,delay:n,easing:[60,10]}),n+=120})},t(document).ready(function(){var e=!1,i=!1;t(".dismissable").each(function(){t(this).hammer({prevent_default:!1}).bind("pan",function(n){if("touch"===n.gesture.pointerType){var a=t(this),o=n.gesture.direction,r=n.gesture.deltaX,s=n.gesture.velocityX;a.velocity({translateX:r},{duration:50,queue:!1,easing:"easeOutQuad"}),4===o&&(r>a.innerWidth()/2||s<-.75)&&(e=!0),2===o&&(r<-1*a.innerWidth()/2||s>.75)&&(i=!0)}}).bind("panend",function(n){if(Math.abs(n.gesture.deltaX)<t(this).innerWidth()/2&&(i=!1,e=!1),"touch"===n.gesture.pointerType){var a=t(this);if(e||i){var o;o=e?a.innerWidth():-1*a.innerWidth(),a.velocity({translateX:o},{duration:100,queue:!1,easing:"easeOutQuad",complete:function(){a.css("border","none"),a.velocity({height:0,padding:0},{duration:200,queue:!1,easing:"easeOutQuad",complete:function(){a.remove()}})}})}else a.velocity({translateX:0},{duration:100,queue:!1,easing:"easeOutQuad"});e=!1,i=!1}})})})}(jQuery),function(t){Materialize.scrollFire=function(t){var e=!1;window.addEventListener("scroll",function(){e=!0}),setInterval(function(){if(e){e=!1;for(var i=window.pageYOffset+window.innerHeight,n=0;n<t.length;n++){var a=t[n],o=a.selector,r=a.offset,s=a.callback,l=document.querySelector(o);if(null!==l){var c=l.getBoundingClientRect().top+window.pageYOffset;if(i>c+r&&a.done!==!0){if("function"==typeof s)s.call(this,l);else if("string"==typeof s){var u=new Function(s);u(l)}a.done=!0}}}}},100)}}(jQuery),/*!
 * pickadate.js v3.5.0, 2014/04/13
 * By Amsul, http://amsul.ca
 * Hosted on http://amsul.github.io/pickadate.js
 * Licensed under MIT
 */
function(t){"function"==typeof define&&define.amd?define("picker",["jquery"],t):"object"==typeof exports?module.exports=t(require("jquery")):this.Picker=t(jQuery)}(function(t){function e(o,r,l,d){function p(){return e._.node("div",e._.node("div",e._.node("div",e._.node("div",T.component.nodes(b.open),x.box),x.wrap),x.frame),x.holder)}function f(){C.data(r,T).addClass(x.input).attr("tabindex",-1).val(C.data("value")?T.get("select",w.format):o.value),w.editable||C.on("focus."+b.id+" click."+b.id,function(t){t.preventDefault(),T.$root.eq(0).focus()}).on("keydown."+b.id,g),a(o,{haspopup:!0,expanded:!1,readonly:!1,owns:o.id+"_root"})}function h(){T.$root.on({keydown:g,focusin:function(t){T.$root.removeClass(x.focused),t.stopPropagation()},"mousedown click":function(e){var i=e.target;i!=T.$root.children()[0]&&(e.stopPropagation(),"mousedown"!=e.type||t(i).is("input, select, textarea, button, option")||(e.preventDefault(),T.$root.eq(0).focus()))}}).on({focus:function(){C.addClass(x.target)},blur:function(){C.removeClass(x.target)}}).on("focus.toOpen",m).on("click","[data-pick], [data-nav], [data-clear], [data-close]",function(){var e=t(this),i=e.data(),n=e.hasClass(x.navDisabled)||e.hasClass(x.disabled),a=s();a=a&&(a.type||a.href),(n||a&&!t.contains(T.$root[0],a))&&T.$root.eq(0).focus(),!n&&i.nav?T.set("highlight",T.component.item.highlight,{nav:i.nav}):!n&&"pick"in i?T.set("select",i.pick):i.clear?T.clear().close(!0):i.close&&T.close(!0)}),a(T.$root[0],"hidden",!0)}function v(){var e;w.hiddenName===!0?(e=o.name,o.name=""):(e=["string"==typeof w.hiddenPrefix?w.hiddenPrefix:"","string"==typeof w.hiddenSuffix?w.hiddenSuffix:"_submit"],e=e[0]+o.name+e[1]),T._hidden=t('<input type=hidden name="'+e+'"'+(C.data("value")||o.value?' value="'+T.get("select",w.formatSubmit)+'"':"")+">")[0],C.on("change."+b.id,function(){T._hidden.value=o.value?T.get("select",w.formatSubmit):""}),w.container?t(w.container).append(T._hidden):C.after(T._hidden)}function g(t){var e=t.keyCode,i=/^(8|46)$/.test(e);return 27==e?(T.close(),!1):void((32==e||i||!b.open&&T.component.key[e])&&(t.preventDefault(),t.stopPropagation(),i?T.clear().close():T.open()))}function m(t){t.stopPropagation(),"focus"==t.type&&T.$root.addClass(x.focused),T.open()}if(!o)return e;var y=!1,b={id:o.id||"P"+Math.abs(~~(Math.random()*new Date))},w=l?t.extend(!0,{},l.defaults,d):d||{},x=t.extend({},e.klasses(),w.klass),C=t(o),k=function(){return this.start()},T=k.prototype={constructor:k,$node:C,start:function(){return b&&b.start?T:(b.methods={},b.start=!0,b.open=!1,b.type=o.type,o.autofocus=o==s(),o.readOnly=!w.editable,o.id=o.id||b.id,"text"!=o.type&&(o.type="text"),T.component=new l(T,w),T.$root=t(e._.node("div",p(),x.picker,'id="'+o.id+'_root" tabindex="0"')),h(),w.formatSubmit&&v(),f(),w.container?t(w.container).append(T.$root):C.after(T.$root),T.on({start:T.component.onStart,render:T.component.onRender,stop:T.component.onStop,open:T.component.onOpen,close:T.component.onClose,set:T.component.onSet}).on({start:w.onStart,render:w.onRender,stop:w.onStop,open:w.onOpen,close:w.onClose,set:w.onSet}),y=i(T.$root.children()[0]),o.autofocus&&T.open(),T.trigger("start").trigger("render"))},render:function(t){return t?T.$root.html(p()):T.$root.find("."+x.box).html(T.component.nodes(b.open)),T.trigger("render")},stop:function(){return b.start?(T.close(),T._hidden&&T._hidden.parentNode.removeChild(T._hidden),T.$root.remove(),C.removeClass(x.input).removeData(r),setTimeout(function(){C.off("."+b.id)},0),o.type=b.type,o.readOnly=!1,T.trigger("stop"),b.methods={},b.start=!1,T):T},open:function(i){return b.open?T:(C.addClass(x.active),a(o,"expanded",!0),setTimeout(function(){T.$root.addClass(x.opened),a(T.$root[0],"hidden",!1)},0),i!==!1&&(b.open=!0,y&&u.css("overflow","hidden").css("padding-right","+="+n()),T.$root.eq(0).focus(),c.on("click."+b.id+" focusin."+b.id,function(t){var e=t.target;e!=o&&e!=document&&3!=t.which&&T.close(e===T.$root.children()[0])}).on("keydown."+b.id,function(i){var n=i.keyCode,a=T.component.key[n],o=i.target;27==n?T.close(!0):o!=T.$root[0]||!a&&13!=n?t.contains(T.$root[0],o)&&13==n&&(i.preventDefault(),o.click()):(i.preventDefault(),a?e._.trigger(T.component.key.go,T,[e._.trigger(a)]):T.$root.find("."+x.highlighted).hasClass(x.disabled)||T.set("select",T.component.item.highlight).close())})),T.trigger("open"))},close:function(t){return t&&(T.$root.off("focus.toOpen").eq(0).focus(),setTimeout(function(){T.$root.on("focus.toOpen",m)},0)),C.removeClass(x.active),a(o,"expanded",!1),setTimeout(function(){T.$root.removeClass(x.opened+" "+x.focused),a(T.$root[0],"hidden",!0)},0),b.open?(b.open=!1,y&&u.css("overflow","").css("padding-right","-="+n()),c.off("."+b.id),T.trigger("close")):T},clear:function(t){return T.set("clear",null,t)},set:function(e,i,n){var a,o,r=t.isPlainObject(e),s=r?e:{};if(n=r&&t.isPlainObject(i)?i:n||{},e){r||(s[e]=i);for(a in s)o=s[a],a in T.component.item&&(void 0===o&&(o=null),T.component.set(a,o,n)),"select"!=a&&"clear"!=a||C.val("clear"==a?"":T.get(a,w.format)).trigger("change");T.render()}return n.muted?T:T.trigger("set",s)},get:function(t,i){if(t=t||"value",null!=b[t])return b[t];if("valueSubmit"==t){if(T._hidden)return T._hidden.value;t="value"}if("value"==t)return o.value;if(t in T.component.item){if("string"==typeof i){var n=T.component.get(t);return n?e._.trigger(T.component.formats.toString,T.component,[i,n]):""}return T.component.get(t)}},on:function(e,i,n){var a,o,r=t.isPlainObject(e),s=r?e:{};if(e){r||(s[e]=i);for(a in s)o=s[a],n&&(a="_"+a),b.methods[a]=b.methods[a]||[],b.methods[a].push(o)}return T},off:function(){var t,e,i=arguments;for(t=0,namesCount=i.length;t<namesCount;t+=1)e=i[t],e in b.methods&&delete b.methods[e];return T},trigger:function(t,i){var n=function(t){var n=b.methods[t];n&&n.map(function(t){e._.trigger(t,T,[i])})};return n("_"+t),n(t),T}};return new k}function i(t){var e,i="position";return t.currentStyle?e=t.currentStyle[i]:window.getComputedStyle&&(e=getComputedStyle(t)[i]),"fixed"==e}function n(){if(u.height()<=l.height())return 0;var e=t('<div style="visibility:hidden;width:100px" />').appendTo("body"),i=e[0].offsetWidth;e.css("overflow","scroll");var n=t('<div style="width:100%" />').appendTo(e),a=n[0].offsetWidth;return e.remove(),i-a}function a(e,i,n){if(t.isPlainObject(i))for(var a in i)o(e,a,i[a]);else o(e,i,n)}function o(t,e,i){t.setAttribute(("role"==e?"":"aria-")+e,i)}function r(e,i){t.isPlainObject(e)||(e={attribute:i}),i="";for(var n in e){var a=("role"==n?"":"aria-")+n,o=e[n];i+=null==o?"":a+'="'+e[n]+'"'}return i}function s(){try{return document.activeElement}catch(t){}}var l=t(window),c=t(document),u=t(document.documentElement);return e.klasses=function(t){return t=t||"picker",{picker:t,opened:t+"--opened",focused:t+"--focused",input:t+"__input",active:t+"__input--active",target:t+"__input--target",holder:t+"__holder",frame:t+"__frame",wrap:t+"__wrap",box:t+"__box"}},e._={group:function(t){for(var i,n="",a=e._.trigger(t.min,t);a<=e._.trigger(t.max,t,[a]);a+=t.i)i=e._.trigger(t.item,t,[a]),n+=e._.node(t.node,i[0],i[1],i[2]);return n},node:function(e,i,n,a){return i?(i=t.isArray(i)?i.join(""):i,n=n?' class="'+n+'"':"",a=a?" "+a:"","<"+e+n+a+">"+i+"</"+e+">"):""},lead:function(t){return(t<10?"0":"")+t},trigger:function(t,e,i){return"function"==typeof t?t.apply(e,i||[]):t},digits:function(t){return/\d/.test(t[1])?2:1},isDate:function(t){return{}.toString.call(t).indexOf("Date")>-1&&this.isInteger(t.getDate())},isInteger:function(t){return{}.toString.call(t).indexOf("Number")>-1&&t%1===0},ariaAttr:r},e.extend=function(i,n){t.fn[i]=function(a,o){var r=this.data(i);return"picker"==a?r:r&&"string"==typeof a?e._.trigger(r[a],r,[o]):this.each(function(){var o=t(this);o.data(i)||new e(this,i,n,a)})},t.fn[i].defaults=n.defaults},e}),/*!
 * Date picker for pickadate.js v3.5.0
 * http://amsul.github.io/pickadate.js/date.htm
 */
function(t){"function"==typeof define&&define.amd?define(["picker","jquery"],t):"object"==typeof exports?module.exports=t(require("./picker.js"),require("jquery")):t(Picker,jQuery)}(function(t,e){function i(t,e){var i=this,n=t.$node[0],a=n.value,o=t.$node.data("value"),r=o||a,s=o?e.formatSubmit:e.format,l=function(){return n.currentStyle?"rtl"==n.currentStyle.direction:"rtl"==getComputedStyle(t.$root[0]).direction};i.settings=e,i.$node=t.$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=(e.disable||[]).slice(0),i.item.enable=-function(t){return t[0]===!0?t.shift():-1}(i.item.disable),i.set("min",e.min).set("max",e.max).set("now"),r?i.set("select",r,{format:s}):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(t){var e=i.item.highlight,n=new Date(e.year,e.month,e.date+t);i.set("highlight",n,{interval:t}),this.render()}},t.on("render",function(){t.$root.find("."+e.klass.selectMonth).on("change",function(){var i=this.value;i&&(t.set("highlight",[t.get("view").year,i,t.get("highlight").date]),t.$root.find("."+e.klass.selectMonth).trigger("focus"))}),t.$root.find("."+e.klass.selectYear).on("change",function(){var i=this.value;i&&(t.set("highlight",[i,t.get("view").month,t.get("highlight").date]),t.$root.find("."+e.klass.selectYear).trigger("focus"))})},1).on("open",function(){var n="";i.disabled(i.get("now"))&&(n=":not(."+e.klass.buttonToday+")"),t.$root.find("button"+n+", select").attr("disabled",!1)},1).on("close",function(){t.$root.find("button, select").attr("disabled",!0)},1)}var n=7,a=6,o=t._;i.prototype.set=function(t,e,i){var n=this,a=n.item;return null===e?("clear"==t&&(t="select"),a[t]=e,n):(a["enable"==t?"disable":"flip"==t?"enable":t]=n.queue[t].split(" ").map(function(a){return e=n[a](t,e,i)}).pop(),"select"==t?n.set("highlight",a.select,i):"highlight"==t?n.set("view",a.highlight,i):t.match(/^(flip|min|max|disable|enable)$/)&&(a.select&&n.disabled(a.select)&&n.set("select",a.select,i),a.highlight&&n.disabled(a.highlight)&&n.set("highlight",a.highlight,i)),n)},i.prototype.get=function(t){return this.item[t]},i.prototype.create=function(t,i,n){var a,r=this;return i=void 0===i?t:i,i==-(1/0)||i==1/0?a=i:e.isPlainObject(i)&&o.isInteger(i.pick)?i=i.obj:e.isArray(i)?(i=new Date(i[0],i[1],i[2]),i=o.isDate(i)?i:r.create().obj):i=o.isInteger(i)||o.isDate(i)?r.normalize(new Date(i),n):r.now(t,i,n),{year:a||i.getFullYear(),month:a||i.getMonth(),date:a||i.getDate(),day:a||i.getDay(),obj:a||i,pick:a||i.getTime()}},i.prototype.createRange=function(t,i){var n=this,a=function(t){return t===!0||e.isArray(t)||o.isDate(t)?n.create(t):t};return o.isInteger(t)||(t=a(t)),o.isInteger(i)||(i=a(i)),o.isInteger(t)&&e.isPlainObject(i)?t=[i.year,i.month,i.date+t]:o.isInteger(i)&&e.isPlainObject(t)&&(i=[t.year,t.month,t.date+i]),{from:a(t),to:a(i)}},i.prototype.withinRange=function(t,e){return t=this.createRange(t.from,t.to),e.pick>=t.from.pick&&e.pick<=t.to.pick},i.prototype.overlapRanges=function(t,e){var i=this;return t=i.createRange(t.from,t.to),e=i.createRange(e.from,e.to),i.withinRange(t,e.from)||i.withinRange(t,e.to)||i.withinRange(e,t.from)||i.withinRange(e,t.to)},i.prototype.now=function(t,e,i){return e=new Date,i&&i.rel&&e.setDate(e.getDate()+i.rel),this.normalize(e,i)},i.prototype.navigate=function(t,i,n){var a,o,r,s,l=e.isArray(i),c=e.isPlainObject(i),u=this.item.view;if(l||c){for(c?(o=i.year,r=i.month,s=i.date):(o=+i[0],r=+i[1],s=+i[2]),n&&n.nav&&u&&u.month!==r&&(o=u.year,r=u.month),a=new Date(o,r+(n&&n.nav?n.nav:0),1),o=a.getFullYear(),r=a.getMonth();new Date(o,r,s).getMonth()!==r;)s-=1;i=[o,r,s]}return i},i.prototype.normalize=function(t){return t.setHours(0,0,0,0),t},i.prototype.measure=function(t,e){var i=this;return e?"string"==typeof e?e=i.parse(t,e):o.isInteger(e)&&(e=i.now(t,e,{rel:e})):e="min"==t?-(1/0):1/0,e},i.prototype.viewset=function(t,e){return this.create([e.year,e.month,1])},i.prototype.validate=function(t,i,n){var a,r,s,l,c=this,u=i,d=n&&n.interval?n.interval:1,p=c.item.enable===-1,f=c.item.min,h=c.item.max,v=p&&c.item.disable.filter(function(t){if(e.isArray(t)){var n=c.create(t).pick;n<i.pick?a=!0:n>i.pick&&(r=!0)}return o.isInteger(t)}).length;if((!n||!n.nav)&&(!p&&c.disabled(i)||p&&c.disabled(i)&&(v||a||r)||!p&&(i.pick<=f.pick||i.pick>=h.pick)))for(p&&!v&&(!r&&d>0||!a&&d<0)&&(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<=f.pick?(s=!0,d=1,i=c.create([f.year,f.month,f.date+(i.pick===f.pick?0:-1)])):i.pick>=h.pick&&(l=!0,d=-1,i=c.create([h.year,h.month,h.date+(i.pick===h.pick?0:1)])),!s||!l);)i=c.create([i.year,i.month,i.date+d]);return i},i.prototype.disabled=function(t){var i=this,n=i.item.disable.filter(function(n){return o.isInteger(n)?t.day===(i.settings.firstDay?n:n-1)%7:e.isArray(n)||o.isDate(n)?t.pick===i.create(n).pick:e.isPlainObject(n)?i.withinRange(n,t):void 0});return n=n.length&&!n.filter(function(t){return e.isArray(t)&&"inverted"==t[3]||e.isPlainObject(t)&&t.inverted}).length,i.item.enable===-1?!n:n||t.pick<i.item.min.pick||t.pick>i.item.max.pick},i.prototype.parse=function(t,e,i){var n=this,a={};return e&&"string"==typeof e?(i&&i.format||(i=i||{},i.format=n.settings.format),n.formats.toArray(i.format).map(function(t){var i=n.formats[t],r=i?o.trigger(i,n,[e,a]):t.replace(/^!/,"").length;i&&(a[t]=e.substr(0,r)),e=e.substr(r)}),[a.yyyy||a.yy,+(a.mm||a.m)-1,a.dd||a.d]):e},i.prototype.formats=function(){function t(t,e,i){var n=t.match(/\w+/)[0];return i.mm||i.m||(i.m=e.indexOf(n)+1),n.length}function e(t){return t.match(/\w+/)[0].length}return{d:function(t,e){return t?o.digits(t):e.date},dd:function(t,e){return t?2:o.lead(e.date)},ddd:function(t,i){return t?e(t):this.settings.weekdaysShort[i.day]},dddd:function(t,i){return t?e(t):this.settings.weekdaysFull[i.day]},m:function(t,e){return t?o.digits(t):e.month+1},mm:function(t,e){return t?2:o.lead(e.month+1)},mmm:function(e,i){var n=this.settings.monthsShort;return e?t(e,n,i):n[i.month]},mmmm:function(e,i){var n=this.settings.monthsFull;return e?t(e,n,i):n[i.month]},yy:function(t,e){return t?2:(""+e.year).slice(2)},yyyy:function(t,e){return t?4:e.year},toArray:function(t){return t.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g)},toString:function(t,e){var i=this;return i.formats.toArray(t).map(function(t){return o.trigger(i.formats[t],i,[0,e])||t.replace(/^!/,"")}).join("")}}}(),i.prototype.isDateExact=function(t,i){var n=this;return o.isInteger(t)&&o.isInteger(i)||"boolean"==typeof t&&"boolean"==typeof i?t===i:(o.isDate(t)||e.isArray(t))&&(o.isDate(i)||e.isArray(i))?n.create(t).pick===n.create(i).pick:!(!e.isPlainObject(t)||!e.isPlainObject(i))&&(n.isDateExact(t.from,i.from)&&n.isDateExact(t.to,i.to))},i.prototype.isDateOverlap=function(t,i){var n=this,a=n.settings.firstDay?1:0;return o.isInteger(t)&&(o.isDate(i)||e.isArray(i))?(t=t%7+a,t===n.create(i).day+1):o.isInteger(i)&&(o.isDate(t)||e.isArray(t))?(i=i%7+a,i===n.create(t).day+1):!(!e.isPlainObject(t)||!e.isPlainObject(i))&&n.overlapRanges(t,i)},i.prototype.flipEnable=function(t){var e=this.item;e.enable=t||(e.enable==-1?1:-1)},i.prototype.deactivate=function(t,i){var n=this,a=n.item.disable.slice(0);return"flip"==i?n.flipEnable():i===!1?(n.flipEnable(1),a=[]):i===!0?(n.flipEnable(-1),a=[]):i.map(function(t){for(var i,r=0;r<a.length;r+=1)if(n.isDateExact(t,a[r])){i=!0;break}i||(o.isInteger(t)||o.isDate(t)||e.isArray(t)||e.isPlainObject(t)&&t.from&&t.to)&&a.push(t)}),a},i.prototype.activate=function(t,i){var n=this,a=n.item.disable,r=a.length;return"flip"==i?n.flipEnable():i===!0?(n.flipEnable(1),a=[]):i===!1?(n.flipEnable(-1),a=[]):i.map(function(t){var i,s,l,c;for(l=0;l<r;l+=1){if(s=a[l],n.isDateExact(s,t)){i=a[l]=null,c=!0;break}if(n.isDateOverlap(s,t)){e.isPlainObject(t)?(t.inverted=!0,i=t):e.isArray(t)?(i=t,i[3]||i.push("inverted")):o.isDate(t)&&(i=[t.getFullYear(),t.getMonth(),t.getDate(),"inverted"]);break}}if(i)for(l=0;l<r;l+=1)if(n.isDateExact(a[l],t)){a[l]=null;break}if(c)for(l=0;l<r;l+=1)if(n.isDateOverlap(a[l],t)){a[l]=null;break}i&&a.push(i)}),a.filter(function(t){return null!=t})},i.prototype.nodes=function(t){var e=this,i=e.settings,r=e.item,s=r.now,l=r.select,c=r.highlight,u=r.view,d=r.disable,p=r.min,f=r.max,h=function(t,e){return i.firstDay&&(t.push(t.shift()),e.push(e.shift())),o.node("thead",o.node("tr",o.group({min:0,max:n-1,i:1,node:"th",item:function(n){return[t[n],i.klass.weekdays,'scope=col title="'+e[n]+'"']}})))}((i.showWeekdaysFull?i.weekdaysFull:i.weekdaysLetter).slice(0),i.weekdaysFull.slice(0)),v=function(t){return o.node("div"," ",i.klass["nav"+(t?"Next":"Prev")]+(t&&u.year>=f.year&&u.month>=f.month||!t&&u.year<=p.year&&u.month<=p.month?" "+i.klass.navDisabled:""),"data-nav="+(t||-1)+" "+o.ariaAttr({role:"button",controls:e.$node[0].id+"_table"})+' title="'+(t?i.labelMonthNext:i.labelMonthPrev)+'"')},g=function(n){var a=i.showMonthsShort?i.monthsShort:i.monthsFull;return"short_months"==n&&(a=i.monthsShort),i.selectMonths&&void 0==n?o.node("select",o.group({min:0,max:11,i:1,node:"option",item:function(t){return[a[t],0,"value="+t+(u.month==t?" selected":"")+(u.year==p.year&&t<p.month||u.year==f.year&&t>f.month?" disabled":"")]}}),i.klass.selectMonth+" browser-default",(t?"":"disabled")+" "+o.ariaAttr({controls:e.$node[0].id+"_table"})+' title="'+i.labelMonthSelect+'"'):"short_months"==n?null!=l?o.node("div",a[l.month]):o.node("div",a[u.month]):o.node("div",a[u.month],i.klass.month)},m=function(n){var a=u.year,r=i.selectYears===!0?5:~~(i.selectYears/2);if(r){var s=p.year,l=f.year,c=a-r,d=a+r;if(s>c&&(d+=s-c,c=s),l<d){var h=c-s,v=d-l;c-=h>v?v:h,d=l}if(i.selectYears&&void 0==n)return o.node("select",o.group({min:c,max:d,i:1,node:"option",item:function(t){return[t,0,"value="+t+(a==t?" selected":"")]}}),i.klass.selectYear+" browser-default",(t?"":"disabled")+" "+o.ariaAttr({controls:e.$node[0].id+"_table"})+' title="'+i.labelYearSelect+'"')}return"raw"==n?o.node("div",a):o.node("div",a,i.klass.year)};return createDayLabel=function(){return null!=l?o.node("div",l.date):o.node("div",s.date)},createWeekdayLabel=function(){var t;t=null!=l?l.day:s.day;var e=i.weekdaysFull[t];return e},o.node("div",o.node("div",createWeekdayLabel(),"picker__weekday-display")+o.node("div",g("short_months"),i.klass.month_display)+o.node("div",createDayLabel(),i.klass.day_display)+o.node("div",m("raw"),i.klass.year_display),i.klass.date_display)+o.node("div",o.node("div",(i.selectYears?g()+m():g()+m())+v()+v(1),i.klass.header)+o.node("table",h+o.node("tbody",o.group({min:0,max:a-1,i:1,node:"tr",item:function(t){var a=i.firstDay&&0===e.create([u.year,u.month,1]).day?-7:0;return[o.group({min:n*t-u.day+a+1,max:function(){return this.min+n-1},i:1,node:"td",item:function(t){t=e.create([u.year,u.month,t+(i.firstDay?1:0)]);var n=l&&l.pick==t.pick,a=c&&c.pick==t.pick,r=d&&e.disabled(t)||t.pick<p.pick||t.pick>f.pick,h=o.trigger(e.formats.toString,e,[i.format,t]);return[o.node("div",t.date,function(e){return e.push(u.month==t.month?i.klass.infocus:i.klass.outfocus),s.pick==t.pick&&e.push(i.klass.now),n&&e.push(i.klass.selected),a&&e.push(i.klass.highlighted),r&&e.push(i.klass.disabled),e.join(" ")}([i.klass.day]),"data-pick="+t.pick+" "+o.ariaAttr({role:"gridcell",label:h,selected:!(!n||e.$node.val()!==h)||null,activedescendant:!!a||null,disabled:!!r||null})),"",o.ariaAttr({role:"presentation"})]}})]}})),i.klass.table,'id="'+e.$node[0].id+'_table" '+o.ariaAttr({role:"grid",controls:e.$node[0].id,readonly:!0})),i.klass.calendar_container)+o.node("div",o.node("button",i.today,"btn-flat picker__today","type=button data-pick="+s.pick+(t&&!e.disabled(s)?"":" disabled")+" "+o.ariaAttr({controls:e.$node[0].id}))+o.node("button",i.clear,"btn-flat picker__clear","type=button data-clear=1"+(t?"":" disabled")+" "+o.ariaAttr({controls:e.$node[0].id}))+o.node("button",i.close,"btn-flat picker__close","type=button data-close=true "+(t?"":" disabled")+" "+o.ariaAttr({controls:e.$node[0].id})),i.klass.footer)},i.defaults=function(t){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"],weekdaysLetter:["S","M","T","W","T","F","S"],today:"Today",clear:"Clear",close:"Close",format:"d mmmm, yyyy",klass:{table:t+"table",header:t+"header",date_display:t+"date-display",day_display:t+"day-display",month_display:t+"month-display",year_display:t+"year-display",calendar_container:t+"calendar-container",navPrev:t+"nav--prev",navNext:t+"nav--next",navDisabled:t+"nav--disabled",month:t+"month",year:t+"year",selectMonth:t+"select--month",selectYear:t+"select--year",weekdays:t+"weekday",day:t+"day",disabled:t+"day--disabled",selected:t+"day--selected",highlighted:t+"day--highlighted",now:t+"day--today",infocus:t+"day--infocus",outfocus:t+"day--outfocus",footer:t+"footer",buttonClear:t+"button--clear",buttonToday:t+"button--today",buttonClose:t+"button--close"}}}(t.klasses().picker+"__"),t.extend("pickadate",i)}),function(t){function e(){var e=+t(this).attr("length"),i=+t(this).val().length,n=i<=e;t(this).parent().find('span[class="character-counter"]').html(i+"/"+e),a(n,t(this))}function i(e){var i=e.parent().find('span[class="character-counter"]');i.length||(i=t("<span/>").addClass("character-counter").css("float","right").css("font-size","12px").css("height",1),e.parent().append(i))}function n(){t(this).parent().find('span[class="character-counter"]').html("")}function a(t,e){var i=e.hasClass("invalid");t&&i?e.removeClass("invalid"):t||i||(e.removeClass("valid"),e.addClass("invalid"))}t.fn.characterCounter=function(){return this.each(function(){var a=t(this),o=a.parent().find('span[class="character-counter"]');if(!o.length){var r=void 0!==a.attr("length");r&&(a.on("input",e),a.on("focus",e),a.on("blur",n),i(a))}})},t(document).ready(function(){t("input, textarea").characterCounter()})}(jQuery),function(t){var e={init:function(e){var i={time_constant:200,dist:-100,shift:0,padding:0,full_width:!1,indicators:!1,no_wrap:!1};return e=t.extend(i,e),this.each(function(){function i(){"undefined"!=typeof window.ontouchstart&&(q[0].addEventListener("touchstart",d),q[0].addEventListener("touchmove",p),q[0].addEventListener("touchend",f)),q[0].addEventListener("mousedown",d),q[0].addEventListener("mousemove",p),q[0].addEventListener("mouseup",f),q[0].addEventListener("mouseleave",f),q[0].addEventListener("click",c)}function n(t){return t.targetTouches&&t.targetTouches.length>=1?t.targetTouches[0].clientX:t.clientX}function a(t){return t.targetTouches&&t.targetTouches.length>=1?t.targetTouches[0].clientY:t.clientY}function o(t){return t>=w?t%w:t<0?o(w+t%w):t}function r(t){var i,n,a,r,s,l,c;if(v="number"==typeof t?t:v,g=Math.floor((v+b/2)/b),a=v-g*b,r=a<0?1:-1,s=-r*a*2/b,n=w>>1,e.full_width?c="translateX(0)":(c="translateX("+(q[0].clientWidth-item_width)/2+"px) ",c+="translateY("+(q[0].clientHeight-item_width)/2+"px)"),V){var u=g%w,d=_.find(".indicator-item.active");d.index()!==u&&(d.removeClass("active"),_.find(".indicator-item").eq(u).addClass("active"))}for((!e.no_wrap||g>=0&&g<w)&&(l=h[o(g)],l.style[P]=c+" translateX("+-a/2+"px) translateX("+r*e.shift*s*i+"px) translateZ("+e.dist*s+"px)",l.style.zIndex=0,e.full_width?tweenedOpacity=1:tweenedOpacity=1-.2*s,l.style.opacity=tweenedOpacity,l.style.display="block"),i=1;i<=n;++i)e.full_width?(zTranslation=e.dist,tweenedOpacity=i===n&&a<0?1-s:1):(zTranslation=e.dist*(2*i+s*r),tweenedOpacity=1-.2*(2*i+s*r)),(!e.no_wrap||g+i<w)&&(l=h[o(g+i)],l.style[P]=c+" translateX("+(e.shift+(b*i-a)/2)+"px) translateZ("+zTranslation+"px)",l.style.zIndex=-i,l.style.opacity=tweenedOpacity,l.style.display="block"),e.full_width?(zTranslation=e.dist,tweenedOpacity=i===n&&a>0?1-s:1):(zTranslation=e.dist*(2*i-s*r),tweenedOpacity=1-.2*(2*i-s*r)),(!e.no_wrap||g-i>=0)&&(l=h[o(g-i)],l.style[P]=c+" translateX("+(-e.shift+(-b*i-a)/2)+"px) translateZ("+zTranslation+"px)",l.style.zIndex=-i,l.style.opacity=tweenedOpacity,l.style.display="block");(!e.no_wrap||g>=0&&g<w)&&(l=h[o(g)],l.style[P]=c+" translateX("+-a/2+"px) translateX("+r*e.shift*s+"px) translateZ("+e.dist*s+"px)",l.style.zIndex=0,e.full_width?tweenedOpacity=1:tweenedOpacity=1-.2*s,l.style.opacity=tweenedOpacity,l.style.display="block")}function s(){var t,e,i,n;t=Date.now(),e=t-E,E=t,i=v-O,O=v,n=1e3*i/(1+e),S=.8*n+.2*S}function l(){var t,i;k&&(t=Date.now()-E,i=k*Math.exp(-t/e.time_constant),i>2||i<-2?(r(T-i),requestAnimationFrame(l)):r(T))}function c(i){if(A)return i.preventDefault(),i.stopPropagation(),!1;if(!e.full_width){var n=t(i.target).closest(".carousel-item").index(),a=g%w-n;0!==a&&(i.preventDefault(),i.stopPropagation()),u(n)}}function u(t){var i=g%w-t;e.no_wrap||(i<0?Math.abs(i+w)<Math.abs(i)&&(i+=w):i>0&&Math.abs(i-w)<i&&(i-=w)),i<0?q.trigger("carouselNext",[Math.abs(i)]):i>0&&q.trigger("carouselPrev",[i])}function d(t){m=!0,A=!1,M=!1,x=n(t),C=a(t),S=k=0,O=v,E=Date.now(),clearInterval(I),I=setInterval(s,100)}function p(t){var e,i,o;if(m)if(e=n(t),y=a(t),i=x-e,o=Math.abs(C-y),o<30&&!M)(i>2||i<-2)&&(A=!0,x=e,r(v+i));else{if(A)return t.preventDefault(),t.stopPropagation(),!1;M=!0}if(A)return t.preventDefault(),t.stopPropagation(),!1}function f(t){if(m)return m=!1,clearInterval(I),T=v,(S>10||S<-10)&&(k=.9*S,T=v+k),T=Math.round(T/b)*b,e.no_wrap&&(T>=b*(w-1)?T=b*(w-1):T<0&&(T=0)),k=T-v,E=Date.now(),requestAnimationFrame(l),A&&(t.preventDefault(),t.stopPropagation()),!1}var h,v,g,m,b,w,x,C,k,T,S,P,O,E,I,A,M,_=t('<ul class="indicators"></ul>'),q=t(this),V=q.attr("data-indicators")||e.indicators;if(q.hasClass("initialized"))return t(this).trigger("carouselNext",[1e-6]),!0;if(e.full_width){e.dist=0;var j=q.find(".carousel-item img").first();j.length?imageHeight=j.on("load",function(){q.css("height",t(this).height())}):(imageHeight=q.find(".carousel-item").first().height(),q.css("height",imageHeight)),V&&q.find(".carousel-fixed-item").addClass("with-indicators")}q.addClass("initialized"),m=!1,v=T=0,h=[],item_width=q.find(".carousel-item").first().innerWidth(),b=2*item_width+e.padding,q.find(".carousel-item").each(function(e){if(h.push(t(this)[0]),V){var i=t('<li class="indicator-item"></li>');0===e&&i.addClass("active"),i.click(function(){var e=t(this).index();u(e)}),_.append(i)}}),V&&q.append(_),w=h.length,P="transform",["webkit","Moz","O","ms"].every(function(t){var e=t+"Transform";return"undefined"==typeof document.body.style[e]||(P=e,!1)}),window.onresize=r,i(),r(v),t(this).on("carouselNext",function(t,e){void 0===e&&(e=1),T=v+b*e,v!==T&&(k=T-v,E=Date.now(),requestAnimationFrame(l))}),t(this).on("carouselPrev",function(t,e){void 0===e&&(e=1),T=v-b*e,v!==T&&(k=T-v,E=Date.now(),requestAnimationFrame(l))}),t(this).on("carouselSet",function(t,e){void 0===e&&(e=0),u(e)})})},next:function(e){t(this).trigger("carouselNext",[e])},prev:function(e){t(this).trigger("carouselPrev",[e])},set:function(e){t(this).trigger("carouselSet",[e])}};t.fn.carousel=function(i){return e[i]?e[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void t.error("Method "+i+" does not exist on jQuery.carousel"):e.init.apply(this,arguments)}}(jQuery);
/**
 * Object that contains all the builder configuration infos
 */
var Rexpansive_Builder_Admin_Config=function(i){"use strict";var t=function(){this.collect=[],this.counter=0,this.real_area=i("#rexbuilder").parent(".meta-box-sortables").width(),this.grid_settings={grid_area_width:this.real_area-46,grid_columns:12,widget_margins:8,widget_dimension:null},this.grid_settings.widget_dimension=Math.round((this.grid_settings.grid_area_width-this.grid_settings.widget_margins*(2*this.grid_settings.grid_columns))/this.grid_settings.grid_columns),this.$builderArea=i("#builder-area"),this.global_section_reference,this.$actual_block_ref=null,this.$lean_overlay=i(".lean-overlay"),this.post_modified=[],this.grid_appearance_modified=!1},e=function(){this.real_area=i("#rexbuilder").parent(".meta-box-sortables").width(),this.grid_settings={grid_area_width:this.real_area-46,grid_columns:12,widget_margins:8,widget_dimension:null},this.grid_settings.widget_dimension=Math.round((this.grid_settings.grid_area_width-this.grid_settings.widget_margins*(2*this.grid_settings.grid_columns))/this.grid_settings.grid_columns)};return{init:t,set_grid_dimensions:e}}(jQuery);
/**
 * Object that contains some utilities
 */
var Rexpansive_Builder_Admin_Utilities=function(e){"use strict";var i,t="#_rexbuilder_shortcode",n=!0,o=function(){e(".tooltipped").not(i).tooltip({delay:50}),i=e(".tooltipped")},s=function(e){e.find(".el-visual-size").text(e.attr("data-sizex")+"x"+e.attr("data-sizey"))},a=function(e){e.css("height","auto"),e.css("width","auto")},d=function(i,t,n){i="undefined"!=typeof i?i:"text",t="undefined"!=typeof t?t:2,n="undefined"!=typeof n?n:2;var o,_="block_"+Rexpansive_Builder_Admin_Config.global_section_reference.sectIndex+"_"+Rexpansive_Builder_Admin_Config.global_section_reference.internalIndex;return o=Rexpansive_Builder_Admin_Templates.templates.text.replace(/\bdata.imageid\b/g,_).replace(/\bdata.elementactionsplaceholder\b/g,Rexpansive_Builder_Admin_Templates.templates.element_actions).replace(/\bdata.blocktype\b/g,i),Rexpansive_Builder_Admin_Config.global_section_reference.gridRef.add_widget(o,t,n),Rexpansive_Builder_Admin_Utilities.update_live_visual_size(e("#"+_)),Rexpansive_Builder_Admin_Config.global_section_reference.internalIndex++,_},r=function(e,i){var t=JSON.parse(e.attr("data-backresponsive"));t.custom_classes+=" "+i.join(" "),e.attr("data-backresponsive",JSON.stringify(t))},c=function(e,i){var t=_.find(e,function(e){return e.sectIndex==i});return t},l=function(i,t,n){t="undefined"!=typeof t&&t,n="undefined"!=typeof n&&n,i.each(function(i,o){var _={id:e(o).attr("id"),mod:t,mod_post_title:n};Rexpansive_Builder_Admin_Config.post_modified.push(_)})},u=function(e,i){var t=_.find(e,function(e){return e.id==i});t.mod=!0},f=function(e,i){var t=_.find(e,function(e){return e.id==i});t.mod_post_title=!0},p=function(e,i){var t=_.find(e,function(e){return e.id==i});return"undefined"!=typeof t&&t.mod},m=function(e,i){var t=_.find(e,function(e){return e.id==i});return"undefined"!=typeof t&&t.mod_post_title},g=function(e){_.each(e,function(e){e.mod=!0})},v=function(e,i,t,n,o,_,s,a,d,r,c,l,u){var f,p,m="";if(m="[RexpansiveSection ",m+=o?'section_name="'+o+'" ':'section_name="" ',i?(f=JSON.parse(i),m+='color_bg_section="'+f.color+'" image_bg_section="'+f.url+'" id_image_bg_section="'+f.image+'" video_bg_url_section="'+f.youtube+'" video_bg_id_section="'+f.video+'" video_bg_url_vimeo_section="'+f.vimeo+'" '):m+='color_bg_section="" image_bg_section="" id_image_bg_section="" ',t?(p=t,m+='dimension="'+p+'" margin="" '):m+='dimension="" margin="" ',m+=n?'layout="'+n+'" ':'layout="" ',s){var g=JSON.parse(s);"rgba("+g.r+","+g.g+","+g.b+","+g.a+")";m+='block_distance="'+g.gutter+'" ',m+='full_height="'+g.isFull+'" ',m+='custom_classes="'+g.custom_classes+'" ',m+='section_width="'+g.section_width+'" '}return m+=_?'responsive_background="'+_+'" ':'responsive_background=""',""!=a&&(m+=' row_separator_top="'+a+'" '),""!=d&&(m+=' row_separator_right="'+d+'" '),""!=r&&(m+=' row_separator_bottom="'+r+'" '),""!=c&&(m+=' row_separator_left="'+c+'" '),""!=l&&(m+=' row_active_photoswipe="'+l+'" '),""!=u&&(m+=' section_model="'+u+'" '),m+="]"+e+"[/RexpansiveSection]"},b=function(){i=e(".tooltipped")};return{init:b,launchTooltips:o,update_live_visual_size:s,resetModalDimensions:a,createNewTextBlock:d,add_class_to_section:r,get_section_based_on_index:c,set_post_modified_list:l,set_post_modified_title:f,set_post_modified:u,post_has_modified:p,set_all_posts_modified:g,post_has_modified_title:m,createSectionShortcode:v,meta_box_selector:t,builderlive:n}}(jQuery);
/**
 * Object that contains the modals utilities
 */
var Rexpansive_Builder_Admin_Modals=function(e){"use strict";var n=function(n,i,d){if(i="undefined"!=typeof i&&i,d="undefined"!=typeof d?d:[],i?n.addClass("rex-in--up"):(e("body").addClass("rex-modal-open"),Rexpansive_Builder_Admin_Config.$lean_overlay.show()),n.addClass("rex-in").show(),d.length)for(var a=0;a<d.length;a++)n.find(".rex-modal").addClass(d[a]);Rexpansive_Builder_Admin_Utilities.resetModalDimensions(n.find(".rex-modal"))},i=function(n,i,d){if(i="undefined"!=typeof i&&i,d="undefined"!=typeof d?d:[],i||n.hasClass("rex-in--up")||(e("body").removeClass("rex-modal-open"),Rexpansive_Builder_Admin_Config.$lean_overlay.hide()),n.removeClass("rex-in").hide(),n.hasClass("rex-in--up")&&n.removeClass("rex-in--up"),d.length)for(var a=0;a<d.length;a++)n.find(".rex-modal").removeClass(d[a]);Rexpansive_Builder_Admin_Config.$actual_block_ref=null,Rexpansive_Builder_Admin_Utilities.resetModalDimensions(n.find(".rex-modal"))};return{OpenModal:n,CloseModal:i}}(jQuery);
/**
 * Object that contains all the usefull templates for the builder
 */
var Rexpansive_Builder_Admin_Templates=function(e){"use strict";var t,i=function(){t={element_actions:e("#rexbuilder-tmpl-element-actions").html().trim(),section:e("#rexbuilder-tmpl-section").html(),empty:e("#rexbuilder-tmpl-empty-element").html(),text:e("#rexbuilder-tmpl-text-element").html().trim(),image:e("#rexbuilder-tmpl-image-element").html().trim(),notice_video:e("#rexbuilder-tmpl-notice-video").html().trim(),add_section:e("#rexbuilder-tmpl-add-section").html()}},m=function(){i(),this.templates=t};return{init:m}}(jQuery);
/**
 * Object that contains all the callbacks that anyone can register to the builder
 */
var Rexpansive_Builder_Admin_Hooks=function(t){"use strict";var n,i,s=function(){return n},c=function(t){n.push(t)},e=function(){return i},u=function(t){i.push(t)},o=function(){n=[],i=[],this.collect=[]};return{init:o,get_switch_actions:s,set_switch_actions:c,get_save_actions:e,set_save_actions:u}}(jQuery);
/**
 * Object that contains the modals utilities
 */
var Rexpansive_Builder_Admin_Lightbox=function(i){"use strict";var t,o,e,n,x=function(){t=i(".rex-lightbox"),o=t.find(".rex-lightbox__bg"),e=t.find(".rex-lightbox__container"),n=t.find(".rex-lightbox__item")},r=function(){t.on("rex_lightbox:open",function(i,x){t.addClass("rex-lightbox--open rex-lightbox--animate_opacity rex-lightbox--animated-in rex-lightbox--visible").css("position","fixed").css("opacity",1),o.css("opacity",1),e.css("transform","translate3d(0px, 0px, 0px)"),n.empty().append(x)}),t.on("rex_lightbox:close",function(){t.removeClass("rex-lightbox--open rex-lightbox--animate_opacity rex-lightbox--animated-in rex-lightbox--visible").css("position","").css("opacity",""),o.css("opacity",""),e.css("transform",""),n.empty()}),t.on("click",function(i){c()})},s=function(i){t.trigger("rex_lightbox:open",i)},c=function(){t.trigger("rex_lightbox:close")},a=function(){x(),r()};return{init:a,open:s,close:c}}(jQuery);
/**
 * Object that contains the Model Editor functionallyties
 * @since 1.1.2
 */
var Rexpansive_Builder_Admin_ModelEditor=function(e){"use strict";var i,t,o,a=function(){t={$modal:e("#rex-model-block"),$cancel_button:null,$save_button:null,$model_name:null,$add_new_model:null,$model_import:null,$model_preview:null},i=t.$modal.parent(".rex-modal-wrap"),t.$cancel_button=t.$modal.find(".rex-cancel-button"),t.$save_button=t.$modal.find(".rex-save-button"),t.$model_name=t.$modal.find("#rex-model__name"),t.$add_new_model=t.$modal.find("#rex-model__add-new-model"),t.$model_preview=t.$modal.find("#rex-model__open-preview"),t.$model_import=t.$modal.find("#rex-model__import"),o=!1},n=function(){e(document).on("click",".builder-model",function(a){a.preventDefault(),a.stopPropagation(),o=!1;var n=e(this).parents(".builder-row");t.$save_button.val(n.attr("data-count")),t.$model_name.val(""),t.$model_import.find("option[value=0]").prop("selected",!0),"undefined"!=typeof n.attr("data-section-model")&&""!=n.attr("data-section-model")&&t.$model_import.find("option[value="+n.attr("data-section-model")+"]").prop("selected",!0),Rexpansive_Builder_Admin_Modals.OpenModal(i)}),t.$model_name.on("focusout",function(e){e.preventDefault(),t.$model_name.parent().removeClass("input-active")}),t.$model_name.on("focusin",function(e){e.preventDefault(),t.$model_name.parent().addClass("input-active")}),t.$save_button.on("click",function(){var a=t.$model_import.val();if(""==a||"0"==a||o)Rexpansive_Builder_Admin_Modals.CloseModal(i);else{t.$modal.addClass("rex-modal--loading");var n={ID:a,section_id:t.$save_button.val()};e.ajax({type:"GET",dataType:"json",url:rexajax.ajaxurl,data:{action:"rex_get_model",nonce_param:rexajax.rexnonce,model_data:n},success:function(i){if(i.success){Rexpansive_Builder_Admin_Config.collect[n.section_id].sectionRef.attr("data-griddimension",i.data.info.dimension),Rexpansive_Builder_Admin_Config.collect[n.section_id].sectionRef.attr("data-layout",i.data.info.layout),Rexpansive_Builder_Admin_Config.collect[n.section_id].sectionRef.attr("data-section-active-photoswipe",i.data.info.row_active_photoswipe),Rexpansive_Builder_Admin_Config.collect[n.section_id].sectionRef.attr("data-row-separator-top",i.data.info.row_separator_top),Rexpansive_Builder_Admin_Config.collect[n.section_id].sectionRef.attr("data-row-separator-bottom",i.data.info.row_separator_bottom),Rexpansive_Builder_Admin_Config.collect[n.section_id].sectionRef.attr("data-row-separator-left",i.data.info.row_separator_left),Rexpansive_Builder_Admin_Config.collect[n.section_id].sectionRef.attr("data-row-separator-right",i.data.info.row_separator_right),Rexpansive_Builder_Admin_Config.collect[n.section_id].sectionRef.attr("data-backresponsive",JSON.stringify(i.data.info.section_bg_responsive)),Rexpansive_Builder_Admin_Config.collect[n.section_id].sectionRef.attr("data-gridproperties",JSON.stringify(i.data.info.section_bg_settings)),Rexpansive_Builder_Admin_Config.collect[n.section_id].sectionRef.attr("data-data-sectionid",i.data.info.section_name),Rexpansive_Builder_Admin_Config.collect[n.section_id].sectionRef.attr("data-section-overlay-color",i.data.info.section_overlay_color),Rexpansive_Builder_Admin_Config.collect[n.section_id].sectionRef.attr("data-section-model",i.data.info.section_model);for(var t in i.data.info.section_bg_style)Rexpansive_Builder_Admin_Config.collect[n.section_id].sectionRef.find(".gridster ul").css(t,i.data.info.section_bg_style[t]);if(Rexpansive_Builder_Admin_Config.collect[n.section_id].sectionRef.find(".background_section_preview").attr("style",i.data.info.section_bg_button_preview_style),Rexpansive_Builder_Admin_Config.collect[n.section_id].sectionRef.find(".builder-edit-row-dimension[value="+i.data.info.dimension+"]").prop("checked","true"),1==i.data.info.section_has_overlay&&Rexpansive_Builder_Admin_Config.collect[n.section_id].sectionRef.find(".section-visual-info").addClass("active-section-visual-info").attr("style",i.data.info.section_overlay_style),Rexpansive_Builder_Admin_Config.collect[n.section_id].gridRef.remove_all_widgets(),i.data.info.tmpl)for(var o=0;o<i.data.info.tmpl.length;o++)Rexpansive_Builder_Admin_Config.collect[n.section_id].gridRef.add_widget(i.data.info.tmpl[o].html,parseInt(i.data.info.tmpl[o].w),parseInt(i.data.info.tmpl[o].h),parseInt(i.data.info.tmpl[o].col),parseInt(i.data.info.tmpl[o].row)),Rexpansive_Builder_Admin_Utilities.update_live_visual_size(e("#"+i.data.info.tmpl[o].id)),Rexpansive_Builder_Admin_Config.collect[n.section_id].internalIndex++;Rexpansive_Builder_Admin_Utilities.launchTooltips()}},error:function(e){},complete:function(e){t.$modal.removeClass("rex-modal--loading"),Rexpansive_Builder_Admin_Modals.CloseModal(i)}})}}),t.$cancel_button.on("click",function(){o=!1,Rexpansive_Builder_Admin_Modals.CloseModal(i)}),t.$add_new_model.on("click",function(){if(""!=t.$model_name.val()){t.$modal.addClass("rex-modal--loading");for(var i=t.$model_name.val(),a={post_title:i,post_content:""},n=t.$save_button.val(),d=Rexpansive_Builder_Admin_Config.collect[n].gridRef.serialize(),l="",r=0;r<d.length;r++)l+=d[r].content;var _=Rexpansive_Builder_Admin_Config.collect[n].sectionRef.attr("data-gridproperties"),s=Rexpansive_Builder_Admin_Config.collect[n].sectionRef.attr("data-griddimension"),c=Rexpansive_Builder_Admin_Config.collect[n].sectionRef.attr("data-layout"),m=Rexpansive_Builder_Admin_Config.collect[n].sectionRef.attr("data-sectionid"),f=Rexpansive_Builder_Admin_Config.collect[n].sectionRef.attr("data-section-overlay-color"),p=Rexpansive_Builder_Admin_Config.collect[n].sectionRef.attr("data-backresponsive"),u=Rexpansive_Builder_Admin_Config.collect[n].sectionRef.attr("data-row-separator-top"),v=Rexpansive_Builder_Admin_Config.collect[n].sectionRef.attr("data-row-separator-right"),x=Rexpansive_Builder_Admin_Config.collect[n].sectionRef.attr("data-row-separator-bottom"),R=Rexpansive_Builder_Admin_Config.collect[n].sectionRef.attr("data-row-separator-left"),g=Rexpansive_Builder_Admin_Config.collect[n].sectionRef.attr("data-section-active-photoswipe"),$=Rexpansive_Builder_Admin_Config.collect[n].sectionRef.attr("data-section-model");a.post_content=Rexpansive_Builder_Admin_Utilities.createSectionShortcode(l,_,s,c,m,f,p,u,v,x,R,g,$),e.ajax({type:"POST",dataType:"json",url:rexajax.ajaxurl,data:{action:"rex_create_model_from_builder",nonce_param:rexajax.rexnonce,model_data:a},success:function(e){e.success&&(t.$model_name.val("").siblings("label").removeClass("active"),t.$save_button.val(""),t.$model_import.children().eq(0).after('<option value="'+e.data.model_id+'">'+e.data.model_title+"</option>"),t.$model_import.find("option[value="+e.data.model_id+"]").prop("selected",!0),Rexpansive_Builder_Admin_Config.collect[n].sectionRef.attr("data-section-model",e.data.model_id),o=!0)},error:function(e){o=!1},complete:function(e){t.$modal.removeClass("rex-modal--loading")}})}else t.$model_name.focus()}),e(document).on("rexbuilder:section_bg_edit",d),e(document).on("rexbuilder:block_bg_edit",d),e(document).on("rexbuilder:block_deleted",d),e(document).on("rexbuilder:block_content_edit",d),t.$model_preview.on("click",function(e){var i=t.$model_import.val();if(0!=i){var o=t.$model_import.find("option[value="+i+"]").attr("data-preview-url");Rexpansive_Builder_Admin_Lightbox.open('<iframe class="rex-model__preview" src="'+o+'"></iframe>')}})},d=function(i,t){e(t).hasClass("builder-row")?t.setAttribute("data-section-model",""):e(t).hasClass("item")&&e(t).parents(".builder-row").attr("data-section-model","")},l=function(){a(),n(),this.$modal_wrap=i};return{init:l}}(jQuery);
/**
 * Object that contains the Padding Editor functionallyties
 */
var Rexpansive_Builder_Admin_PaddingEditor=function(e){"use strict";var a,d,n=function(){d={$trigger:e("#content-padding-open-modal"),$modal:e("#block-modal-content-padding"),$block_padding_top:e("#block-padding-top"),$block_padding_right:e("#block-padding-right"),$block_padding_bottom:e("#block-padding-bottom"),$block_padding_left:e("#block-padding-left"),$block_padding_type_pixel:e(".block-padding-type[value=pixel]"),$block_padding_type_percentage:e(".block-padding-type[value=percentage]"),$save_button:e("#block-set-content-padding-save"),$cancel_button:e("#block-set-content-padding-cancel")},a=d.$modal.parent(".rex-modal-wrap")},l=function(){d.$trigger.on("click",function(){var n=e("#editor-save").val(),l=e(n).attr("data-content-padding");if("undefined"!=typeof l&&""!=l){var o=l.split(";");o.length>1?(d.$block_padding_top.val(o[0].replace(/[\D]+/g,"")),d.$block_padding_right.val(o[1].replace(/[\D]+/g,"")),d.$block_padding_bottom.val(o[2].replace(/[\D]+/g,"")),d.$block_padding_left.val(o[3].replace(/[\D]+/g,""))):(d.$block_padding_top.val(o[0].replace(/[\D]+/g,"")),d.$block_padding_right.val(o[0].replace(/[\D]+/g,"")),d.$block_padding_bottom.val(o[0].replace(/[\D]+/g,"")),d.$block_padding_left.val(o[0].replace(/[\D]+/g,"")));var t=o[0].match(/[\D]+/g)[0];switch(t){case"px":d.$block_padding_type_pixel.prop("checked",!0);break;case"%":d.$block_padding_type_percentage.prop("checked",!0)}}else d.$block_padding_top.val("5"),d.$block_padding_right.val("5"),d.$block_padding_bottom.val("5"),d.$block_padding_left.val("5"),d.$block_padding_type_pixel.prop("checked",!0);Rexpansive_Builder_Admin_Modals.OpenModal(a,!0)}),d.$save_button.on("click",function(){var n=e("#editor-save").val(),l="",o=e(".block-padding-type:checked").val(),t="";switch(o){case"percentage":t="%;";break;case"pixel":t="px;"}var c=d.$block_padding_top.val(),p=d.$block_padding_right.val(),i=d.$block_padding_bottom.val(),_=d.$block_padding_left.val();l+="undefined"!=typeof c&&""!=c&&c.search(/[\d]+/g)!==-1?c+t:"0"+t,l+="undefined"!=typeof p&&""!=p&&p.search(/[\d]+/g)!==-1?p+t:"0"+t,l+="undefined"!=typeof i&&""!=i&&i.search(/[\d]+/g)!==-1?i+t:"0"+t,l+="undefined"!=typeof _&&""!=_&&_.search(/[\d]+/g)!==-1?_+t:"0"+t,e(n).attr("data-content-padding",l),Rexpansive_Builder_Admin_Modals.CloseModal(a,!0)}),d.$cancel_button.on("click",function(){Rexpansive_Builder_Admin_Modals.CloseModal(a,!0)})},o=function(){n(),l(),this.$modal_wrap=a};return{init:o}}(jQuery);
/**
 * Object that contains the Position Editor functionallyties
 */
var Rexpansive_Builder_Admin_PositionEditor=function(e){"use strict";var t,o,n=function(){o={$trigger:e("#content-position-open-modal"),$modal:e("#block-modal-content-position"),$save_button:e("#block-set-content-position-save"),$cancel_button:e("#block-set-content-position-cancel"),$positions:e("#block-modal-content-position .content-position")},t=o.$modal.parent(".rex-modal-wrap")},i=function(){o.$trigger.on("click",function(){var n=e("#editor-save").val(),i=e(n).attr("data-block-custom-classes");if(o.$positions.prop("checked",!1),"undefined"!=typeof i&&""!=i){var l=i.match(/rex-flex-(top|middle|bottom|left|center|right)/g);if(l&&l.length>0){l[0]=l[0].replace("rex-flex-",""),l[1]=l[1].replace("rex-flex-","");var d="[value=";d+=l[0].search(/(top|middle|bottom)/g)!=-1?l[0]+"-"+l[1]+"]":l[1]+"-"+l[0]+"]",o.$positions.filter(d).prop("checked",!0)}else o.$positions.prop("checked",!1)}Rexpansive_Builder_Admin_TextEditor.$text_editor.addClass("push-down-modal"),Rexpansive_Builder_Admin_Modals.OpenModal(t,!0)}),o.$save_button.on("click",function(){var n=e("#editor-save").val(),i=e(n).attr("data-block-custom-classes"),l="",d="";"undefined"!=typeof i&&""!=i||(i="");var s=o.$positions.filter(":checked").val();if(i=i.replace(/rex-flex-(top|middle|bottom|left|center|right)\s*/g,""),"undefined"!=typeof s&&""!==s){d+="element-content-positioned";var r=s.match(/(top|middle|bottom|left|center|right)/g);switch(r[0]){case"top":l+=" rex-flex-top",d+=" element-content-positioned-top";break;case"middle":l+=" rex-flex-middle",d+=" element-content-positioned-middle";break;case"bottom":l+=" rex-flex-bottom",d+=" element-content-positioned-bottom"}switch(r[1]){case"left":l+=" rex-flex-left",d+=" element-content-positioned-left";break;case"center":l+=" rex-flex-center",d+=" element-content-positioned-center";break;case"right":l+=" rex-flex-right",d+=" element-content-positioned-right"}}i=i+" "+l.trim(),e(n).attr("data-block-custom-classes",i.trim()),e(n).find(".element-preview-wrap").removeClass("element-content-positioned-top element-content-positioned-middle element-content-positioned-bottom element-content-positioned-left element-content-positioned-center element-content-positioned-right").addClass(d),Rexpansive_Builder_Admin_TextEditor.$text_editor.removeClass("push-down-modal"),Rexpansive_Builder_Admin_Modals.CloseModal(t,!0)}),o.$cancel_button.on("click",function(){Rexpansive_Builder_Admin_TextEditor.$text_editor.removeClass("push-down-modal"),Rexpansive_Builder_Admin_Modals.CloseModal(t,!0)})},l=function(){n(),i(),this.$modal_wrap=t};return{init:l}}(jQuery);
/**
 * Contact Form Shortcode Editor panel
 */
var Rexpansive_Builder_Admin_Rxcf=function(e){"use strict";var a,n,o,c,t,r,i=function(){a=e("#rex-rxcf-editor"),r=a.parent(),n=a.find("#rex-rxcf-editor_input"),o=a.find(".rex-rxcf-editor_copy"),c=a.find(".rex-save-button"),t=a.find(".rex-cancel-button")},d=function(){e(document).on("click",".rxcf7-get_shortcode",function(o){o.preventDefault(),Rexpansive_Builder_Admin_Modals.OpenModal(r),a.addClass("rex-modal--loading"),n.val("");var t={id:e(this).attr("data-cfid")};c.val(t.id),e.ajax({type:"GET",dataType:"json",url:rexajax.ajaxurl,data:{action:"rex_get_rxcf",nonce_param:rexajax.rexnonce,cf_data:t},success:function(e){e.success&&n.val(e.data.shortcode)},complete:function(e){a.removeClass("rex-modal--loading")}})}),c.on("click",function(o){var c={id:e(this).val(),shortcode:n.val()};""!=c.shortcode?e.ajax({type:"POST",dataType:"json",url:rexajax.ajaxurl,data:{action:"rex_save_rxcf",nonce_param:rexajax.rexnonce,cf_data:c},success:function(e){e.success&&console.log(e)},complete:function(e){a.removeClass("rex-modal--loading"),Rexpansive_Builder_Admin_Modals.CloseModal(r)}}):Rexpansive_Builder_Admin_Modals.CloseModal(r)}),t.on("click",function(e){Rexpansive_Builder_Admin_Modals.CloseModal(r)}),o.on("click",function(e){e.preventDefault(),n.select(),document.execCommand("copy")})},l=function(){i(),d()};return{init:l}}(jQuery);
/**
 * Object that contains the TextEditor definition
 */
var Rexpansive_Builder_Admin_TextEditor=function(e){"use strict";var i,d,t,a,n,l=function(i,t,a,l){a="undefined"!=typeof a&&a,l="undefined"!=typeof l?l:[];var r=tinyMCE.get("rexbuilder_editor");"undefined"!=typeof i&&null!==i&&n.val(i),"undefined"==typeof r||null===r?(e("#rexbuilder_editor").val(t),e("#rexbuilder_editor").text(t)):(r.setContent(t),r.save({no_events:!0})),Rexpansive_Builder_Admin_Modals.OpenModal(d,a,l)},r=function(){t.on("click",function(e){e.preventDefault(),n.val(""),Rexpansive_Builder_Admin_Modals.CloseModal(d,!1,["hide-padding-position"]),tinyMCE.triggerSave()}),a.on("click",function(e){e.preventDefault(),a.val(""),n.val(""),Rexpansive_Builder_Admin_Modals.CloseModal(Rexpansive_Builder_Admin_PaddingEditor.$modal_wrap,!0),Rexpansive_Builder_Admin_Modals.CloseModal(Rexpansive_Builder_Admin_PositionEditor.$modal_wrap,!0),Rexpansive_Builder_Admin_Modals.CloseModal(d,!1,["hide-padding-position"])}),n.on("click",function(i){i.preventDefault(),"new-block"==a.val()&&(Rexpansive_Builder_Admin_Utilities.createNewTextBlock(),Rexpansive_Builder_Admin_Utilities.launchTooltips()),tinyMCE.triggerSave();var t=(tinyMCE.get("rexbuilder_editor"),e("#rexbuilder_editor")),n=t.val(),l=e(e(this).val()),r=l.attr("data-block_type");switch(r){case"image":l.find(".element-preview .backend-image-preview").empty().append(n.replace(/'/gi,"’"));break;case"slide":l.find("textarea[name=rex-slider--slide-text]").text(n.replace(/'/gi,"’")),""!=n?l.find(".rex-slider__slide-edit[value=text]").addClass("rex-slider__slide-edit__field-active-notice"):l.find(".rex-slider__slide-edit[value=text]").removeClass("rex-slider__slide-edit__field-active-notice");break;case"empty":l.attr("data-block_type","text").removeClass("empty").addClass("text").find(".element-preview").empty().append(n.replace(/'/gi,"’"));break;default:l.find(".element-preview").empty().append(n.replace(/'/gi,"’"))}l.find(".data-text-content").text(n.replace(/'/gi,"’")),a.val(""),Rexpansive_Builder_Admin_Modals.CloseModal(Rexpansive_Builder_Admin_PaddingEditor.$modal_wrap,!0),Rexpansive_Builder_Admin_Modals.CloseModal(Rexpansive_Builder_Admin_PositionEditor.$modal_wrap,!0),Rexpansive_Builder_Admin_Modals.CloseModal(d,!1,["hide-padding-position"]),e(document).trigger("rexbuilder:block_content_edit",l)})},o=function(){i=e("#rexeditor-modal"),d=i.parent(".rex-modal-wrap"),t=e("#rexeditor-close"),a=e("#editor-cancel"),n=e("#editor-save")},_=function(){o(),r(),this.$text_editor=i,this.$text_editor_modal_wrap=d};return{init:_,openTextEditor:l}}(jQuery);
/**
 * Object that contains the TextEditor definition
 */
var Rexpansive_Builder_Admin_VideoEditor=function(e){"use strict";var i,o,a=function(){i.$save_button.on("click",function(){var a={color:"",image:"",url:"",bg_img_type:"full",linkurl:"",video:"",youtube:i.$video_youtube_url.val(),vimeo:i.$video_vimeo_url.val()};if(""!=i.$video_youtube_url.val()){var d='<li id="block_'+Rexpansive_Builder_Admin_Config.global_section_reference.sectIndex+"_"+Rexpansive_Builder_Admin_Config.global_section_reference.internalIndex+"\" class=\"video with-border item z-depth-1 hoverable svg-ripple-effect\" data-block_type=\"video\" data-block-custom-classes='' data-content-padding='' data-bg_settings='"+JSON.stringify(a)+'\' data-video-has-audio="1">'+Rexpansive_Builder_Admin_Templates.templates.element_actions+'<div class="element-data"><textarea class="data-text-content" display="none"></textarea></div><div class="element-preview-wrap"><div class="element-preview"><div class="backend-image-preview" data-image_id=""></div></div></div>'+Rexpansive_Builder_Admin_Templates.templates.notice_video+"</li>";Rexpansive_Builder_Admin_Config.global_section_reference.gridRef.add_widget(d,2,2),Rexpansive_Builder_Admin_Utilities.update_live_visual_size(e("#block_"+Rexpansive_Builder_Admin_Config.global_section_reference.sectIndex+"_"+Rexpansive_Builder_Admin_Config.global_section_reference.internalIndex)),Rexpansive_Builder_Admin_Config.global_section_reference.internalIndex++}else if(""!=i.$video_vimeo_url.val()){var d='<li id="block_'+Rexpansive_Builder_Admin_Config.global_section_reference.sectIndex+"_"+Rexpansive_Builder_Admin_Config.global_section_reference.internalIndex+"\" class=\"video with-border item z-depth-1 hoverable svg-ripple-effect\" data-block_type=\"video\" data-block-custom-classes='' data-content-padding='' data-bg_settings='"+JSON.stringify(a)+'\' data-video-has-audio="1">'+Rexpansive_Builder_Admin_Templates.templates.element_actions+'<div class="element-data"><textarea class="data-text-content" display="none"></textarea></div><div class="element-preview-wrap"><div class="element-preview"><div class="backend-image-preview" data-image_id=""></div></div></div>'+Rexpansive_Builder_Admin_Templates.templates.notice_video+"</li>";Rexpansive_Builder_Admin_Config.global_section_reference.gridRef.add_widget(d,2,2),Rexpansive_Builder_Admin_Utilities.update_live_visual_size(e("#block_"+Rexpansive_Builder_Admin_Config.global_section_reference.sectIndex+"_"+Rexpansive_Builder_Admin_Config.global_section_reference.internalIndex)),Rexpansive_Builder_Admin_Config.global_section_reference.internalIndex++}Rexpansive_Builder_Admin_Modals.CloseModal(o)}),i.$cancel_button.on("click",function(){Rexpansive_Builder_Admin_Modals.CloseModal(o)}),i.$video_upload.on("click",function(){Rexpansive_Builder_Admin_VideoUploader.uploadVideoBlock()}),i.$video_youtube_url.on("change keyup paste",function(){""!=e(this).val()?i.$video_youtube.attr("checked",!0):i.$video_youtube.attr("checked",!1)}),i.$video_vimeo_url.on("change keyup paste",function(){""!=e(this).val()?i.$video_vimeo.attr("checked",!0):i.$video_vimeo.attr("checked",!1)})},d=function(){i={$modal:e("#rex-video-block"),$modal_wrap:null,$video_choose:e(".rex-choose-video"),$video_upload:e("#rex-upload-mp4"),$video_mp4:e("#rex-choose-mp4"),$video_mp4_id:e("#rex-mp4-id"),$video_youtube:e("#rex-choose-youtube"),$video_youtube_url:e("#rex-youtube-url"),$video_youtube_label:e("#rex-youtube-url-label"),$video_vimeo:e("#rex-choose-vimeo"),$video_vimeo_url:e("#rex-vimeo-url"),$video_vimeo_label:e("#rex-vimeo-url-label"),$save_button:e("#rex-video-block-save"),$cancel_button:e("#rex-video-block-cancel")},o=i.$modal.parent(".rex-modal-wrap")},l=function(){i.$video_choose.prop("checked",!1),i.$video_mp4_id.val(""),i.$video_youtube_url.val(""),i.$video_youtube_label.removeClass("active"),i.$video_vimeo_url.val(""),i.$video_vimeo_label.removeClass("active")},n=function(){i.$video_mp4_id.val(""),i.$video_mp4.prop("checked",!1)},_=function(){d(),a(),this.$modal_wrap=o};return{init:_,reset_editor:l,reset_editor_mp4:n}}(jQuery);
/**
 * Object that contains the image media uploader
 */
var Rexpansive_Builder_Admin_MediaUploader=function(e){"use strict";function t(){if(i)return void i.open();var t=wp.media.controller.Library.extend({defaults:_.defaults({id:"insert-image",title:"Insert Image",allowLocalEdits:!0,displaySettings:!0,displayUserSettings:!0,multiple:!0,library:wp.media.query({type:"image"}),type:"image"},wp.media.controller.Library.prototype.defaults)});i=wp.media({button:{text:"Select"},state:"insert-image",states:[new t]}),i.on("close",function(){var e=i.state("insert-image").get("selection");!e.length}),i.on("select",function(){var t=i.state("insert-image"),a=t.get("selection");a&&(a.each(function(i){var a,n,r=t.display(i).toJSON(),l=i.toJSON(),s=l.caption;if(wp.media.view.settings.captions||delete l.caption,r=wp.media.string.props(r,l),a={id:l.id,post_content:l.description,post_excerpt:s},r.linkUrl&&(a.url=r.linkUrl),"image"===l.type){var o;o=r.src;var d;switch(Rexpansive_Builder_Admin_Config.global_section_reference.sectionRef.attr("data-layout")){case"masonry":d="natural";break;case"full":default:d="full"}var c;switch(Rexpansive_Builder_Admin_Config.global_section_reference.sectionRef.attr("data-section-active-photoswipe")){case"1":c="true";break;case"0":default:c=""}var p={color:"",image:l.id,url:l.url,image_size:r.size,bg_img_type:d,photoswipe:c,linkurl:"",block_custom_class:"",block_padding:"",video:"",youtube:"",overlay_block_color:""},_="block_"+Rexpansive_Builder_Admin_Config.global_section_reference.sectIndex+"_"+Rexpansive_Builder_Admin_Config.global_section_reference.internalIndex,n=Rexpansive_Builder_Admin_Templates.templates.image.replace(/\bdata.textid\b/,_).replace(/\bdata.bgblocksetts\b/,JSON.stringify(p)).replace(/\bdata.elementactionsplaceholder\b/,Rexpansive_Builder_Admin_Templates.templates.element_actions).replace(/\bdata.imgprevsrc\b/,o).replace(/\bdata.attachmentid\b/,l.id);n="natural"==d?n.replace(/\bdata.isnaturalimage\b/,"block-is-natural"):n.replace(/\bdata.isnaturalimage\b/,"")}else"video"===l.type?n=wp.media.string.video(r,l):"audio"===l.type?n=wp.media.string.audio(r,l):(n=wp.media.string.link(r),a.post_title=r.title);i.attributes.nonce=wp.media.view.settings.nonce.sendToEditor,i.attributes.attachment=a,i.attributes.html=n,i.attributes.post_id=wp.media.view.settings.post.id,Rexpansive_Builder_Admin_Config.global_section_reference.gridRef.add_widget(i.attributes.html,2,2),Rexpansive_Builder_Admin_Utilities.update_live_visual_size(e("#"+_)),Rexpansive_Builder_Admin_Config.global_section_reference.internalIndex++,Rexpansive_Builder_Admin_Utilities.launchTooltips()}),e(document).trigger("sectionCollectData",Rexpansive_Builder_Admin_Config.global_section_reference))}),i.on("open",function(){var e=i.state("insert-image").get("selection");e.each(function(t){var i=wp.media.attachment(t.attributes.id);i.fetch(),e.remove(i?[i]:[])})}),i.open()}var i;return{RenderMediaUploader:t}}(jQuery);
var Rexpansive_Builder_Admin_VideoUploader=function(e){"use strict";function i(){if(t)return void t.open();var i=wp.media.controller.Library.extend({defaults:_.defaults({id:"insert-video",title:"Insert Video",allowLocalEdits:!0,displaySettings:!0,displayUserSettings:!0,multiple:!0,library:wp.media.query({type:"video"}),type:"video"},wp.media.controller.Library.prototype.defaults)});t=wp.media({button:{text:"Select"},state:"insert-video",states:[new i]}),t.on("close",function(){t.state("insert-video").get("selection");Rexpansive_Builder_Admin_VideoEditor.reset_editor_mp4()}),t.on("select",function(){var i=t.state("insert-video"),n=i.get("selection");n&&(n.each(function(t){var n,a,d=i.display(t).toJSON(),o=t.toJSON(),s=o.caption;if(wp.media.view.settings.captions||delete o.caption,d=wp.media.string.props(d,o),n={id:o.id,post_content:o.description,post_excerpt:s},d.linkUrl&&(n.url=d.linkUrl),"video"===o.type){var l;l=o.url;var r={color:"",image:"",url:"",bg_img_type:"full",image_size:"",block_custom_class:"",block_padding:"",photoswipe:"",linkurl:"",video:o.id,youtube:"",overlay_block_color:""};a='<li id="block_'+Rexpansive_Builder_Admin_Config.global_section_reference.sectIndex+"_"+Rexpansive_Builder_Admin_Config.global_section_reference.internalIndex+"\" class=\"video with-border item z-depth-1 hoverable svg-ripple-effect\" data-block_type=\"video\" data-block-custom-classes='' data-content-padding='' data-bg_settings='"+JSON.stringify(r)+'\' data-video-has-audio="1">'+Rexpansive_Builder_Admin_Templates.templates.element_actions+'<div class="element-data"><textarea class="data-text-content" display="none"></textarea></div><div class="element-preview-wrap"><div class="element-preview"><div class="backend-image-preview" data-image_id="'+o.id+'"></div></div></div>'+Rexpansive_Builder_Admin_Templates.templates.notice_video+"</li>"}else"image"===o.type?a=wp.media.string.video(d,o):"audio"===o.type?a=wp.media.string.audio(d,o):(a=wp.media.string.link(d),n.post_title=d.title);t.attributes.nonce=wp.media.view.settings.nonce.sendToEditor,t.attributes.attachment=n,t.attributes.html=a,t.attributes.post_id=wp.media.view.settings.post.id,Rexpansive_Builder_Admin_Config.global_section_reference.gridRef.add_widget(t.attributes.html,2,2),Rexpansive_Builder_Admin_Utilities.update_live_visual_size(e("#block_"+Rexpansive_Builder_Admin_Config.global_section_reference.sectIndex+"_"+Rexpansive_Builder_Admin_Config.global_section_reference.internalIndex)),Rexpansive_Builder_Admin_Config.global_section_reference.internalIndex++,Rexpansive_Builder_Admin_Utilities.launchTooltips()}),Rexpansive_Builder_Admin_Modals.CloseModal(Rexpansive_Builder_Admin_VideoEditor.$modal_wrap),e(document).trigger("sectionCollectData",Rexpansive_Builder_Admin_Config.global_section_reference))}),t.on("open",function(){var e=t.state("insert-video").get("selection");e.each(function(i){var t=wp.media.attachment(i.attributes.id);t.fetch(),e.remove(t?[t]:[])})}),t.open()}var t;return{uploadVideoBlock:i}}(jQuery);
/**
 * Object that contains a Section Object
 * @todo  substitue events with methods
 */
var Rexpansive_Builder_Admin_Section=function(e){"use strict";function i(i,t){this.sectionRef=i,this.gridRef=null,this.sectIndex=t,this.gridSerialized=null,this.internalIndex=0,this.gridster_options=null,this.init=function(){this.sectionRef.attr("data-count",this.sectIndex),this.launchGrid();var e=_.max(_.map(_.pluck(this.gridRef.$widgets,"id"),function(e){return parseInt(e.substring(e.lastIndexOf("_")+1,e.length))}))+1;"-Infinity"!=e&&(this.internalIndex=e)},this.launchGrid=function(){var i=Rexpansive_Builder_Admin_Config.grid_settings.widget_dimension,t=Rexpansive_Builder_Admin_Config.grid_settings.widget_margins;this.gridster_options={widget_selector:".item",resize:{enabled:!0,axes:["x","y","both"],stop:function(e,i,t){Rexpansive_Builder_Admin_Utilities.update_live_visual_size(t),Rexpansive_Builder_Admin_Utilities.set_all_posts_modified(Rexpansive_Builder_Admin_Config.post_modified)}},draggable:{stop:function(e,i){Rexpansive_Builder_Admin_Utilities.set_all_posts_modified(Rexpansive_Builder_Admin_Config.post_modified)}},widget_margins:[t,t],widget_base_dimensions:[i,i],min_cols:Rexpansive_Builder_Admin_Config.grid_settings.grid_columns,serialize_params:function(e,i){var t=e.attr("data-block_type"),d="",a=e.attr("data-bg_settings"),n=e.attr("data-block-custom-classes"),s=e.attr("data-content-padding"),r=e.attr("data-video-has-audio");switch(t){case"text":d=e.find(".data-text-content").text();break;case"rexslider":d=e.find(".data-text-content").text();break;case"video":d=e.find(".data-text-content").text();break;case"image":d=e.find(".data-text-content").text();break;case"expand":d=e.find(".data-zak-content").attr("data-zak-content");break;case"empty":e.find(".data-text-content").length>0&&(d=e.find(".data-text-content").text())}var _="";if(_+='[RexpansiveBlock id="'+e.prop("id")+'" type="'+t+'" col="'+i.col+'" row="'+i.row+'" size_x="'+i.size_x+'" size_y="'+i.size_y+'"',a){var o=JSON.parse(a);_+=' color_bg_block="'+o.color+'" image_bg_block="'+o.url+'" id_image_bg_block="'+o.image+'" type_bg_block="'+o.bg_img_type+'" video_bg_id="'+o.video+'" video_bg_url="'+o.youtube+'" video_bg_url_vimeo="'+o.vimeo+'" photoswipe="'+o.photoswipe+'" linkurl="'+o.linkurl+'" image_size="'+o.image_size+'" overlay_block_color="'+o.overlay_block_color+'"'}else _+=' color_bg_block="" image_bg_block="" id_image_bg_block="" type_bg_block="" photoswipe="" linkurl=""';if(n&&(_+=' block_custom_class="'+n+'" '),s&&(_+=' block_padding="'+s+'" '),r&&"1"==r&&(_+=' video_has_audio="1" '),"expand"==t){var l=JSON.parse(d);_+=' zak_background="'+l.background_id+'" zak_title="'+l.title+'" zak_side="'+l.side+'" zak_icon="'+l.icon_id+'" zak_foreground="'+l.foreground_id+'"'}return _+=' edited_from_backend="true"',_+="]",_+="expand"==t?JSON.parse(d).content:d,_+="[/RexpansiveBlock]",{id:e.prop("id"),content:_,col:i.col,row:i.row,size_x:i.size_x,size_y:i.size_y}}};var d=this.gridster_options;this.gridRef=this.sectionRef.find(".gridster > ul").gridster(d).data("gridster"),e(document).trigger("sectionCollectData",[this])},this.addElementOnGrid=function(i){var t,d="block_"+this.sectIndex+"_"+this.internalIndex;switch(Rexpansive_Builder_Admin_Config.global_section_reference=this,i){case"image":Rexpansive_Builder_Admin_MediaUploader.RenderMediaUploader();break;case"text":Rexpansive_Builder_Admin_TextEditor.openTextEditor('.builder-row[data-count="'+this.sectIndex+'"] #'+d,""),e("#editor-cancel").val("new-block");break;case"expand":Rexpansive_Builder_Admin_Config.$builderArea.trigger("rexpansive-builder.open-zak-editor",['.builder-row[data-count="'+this.sectIndex+'"] #'+d,""]),t='<li id="'+d+"\" class=\"expand item z-depth-1 hoverable svg-ripple-effect\" data-block_type=\"expand\" data-block-custom-classes='' data-content-padding='' data-bg_settings=''>"+Rexpansive_Builder_Admin_Templates.templates.element_actions+'<div class="element-data"><input class="data-zak-content" type="hidden" value=\'\' data-zak-content=\'\'></div><div class="element-preview"><div class="zak-block zak-image-side"></div><div class="zak-block zak-text-side"></div></div></li>',this.gridRef.add_widget(t,12,2),Rexpansive_Builder_Admin_Utilities.update_live_visual_size(e("#"+d)),this.internalIndex++,Rexpansive_Builder_Admin_Utilities.launchTooltips();break;case"video":Rexpansive_Builder_Admin_VideoEditor.reset_editor(),Rexpansive_Builder_Admin_Modals.OpenModal(Rexpansive_Builder_Admin_VideoEditor.$modal_wrap);break;case"rexslider":Rexpansive_Builder_Admin_Config.$builderArea.trigger("rexpansive-builder.open-slider-editor");break;case"empty":t=Rexpansive_Builder_Admin_Templates.templates.empty.replace(/\bdata.emptyid\b/g,d),this.gridRef.add_widget(t,2,2),Rexpansive_Builder_Admin_Utilities.update_live_visual_size(e("#"+d)),this.internalIndex++,Rexpansive_Builder_Admin_Utilities.launchTooltips()}},this.copyElementToGrid=function(e){var i=e.attr("id").match(/block_\d+_/g);if(i.length>0){i=i[0]+this.internalIndex,e.attr("id",i);var t=parseInt(e.attr("data-sizex")),d=parseInt(e.attr("data-sizey")),a=e.wrap("<p/>").parent().html();this.gridRef.add_widget(a,t,d),this.internalIndex++,Rexpansive_Builder_Admin_Utilities.launchTooltips()}},this.removeElementFromGrid=function(i){this.gridRef.remove_widget(i),e(document).trigger("sectionCollectData",[this])},this.collectGridData=function(){this.gridSerialized=this.gridRef.serialize(),this.gridSerialized=Gridster.sort_by_row_and_col_asc(this.gridSerialized);var e=_.map(this.gridSerialized,function(e){return _.first(_.values(_.pick(e,"content")))});this.sectionRef.attr("data-gridcontent",e.join(""))},this.fillEmptyCells=function(){var i,t,d,a,n,s,r,_,o,l=this.gridRef.container_width/this.gridRef.min_widget_width,c=this.gridRef.container_height/this.gridRef.min_widget_width;for(a=1;a<=c;a++)for(d=1;d<=l;d++)if(this.gridRef.is_empty(d,a)){for(n=0,s=r=1,_=d,o=a;_<=l&&this.gridRef.is_empty(_,o);)n=_,_++;for(s=_-d,o++,_=d;o<=c;){for(;_<=n&&this.gridRef.is_empty(_,o);)_++;if(_-1!=n)break;o++,_=d}r=o-a,i="block_"+this.sectIndex+"_"+this.internalIndex,t=Rexpansive_Builder_Admin_Templates.templates.empty.replace(/\bdata.emptyid\b/g,i),this.gridRef.add_widget(t,s,r,d,a),Rexpansive_Builder_Admin_Utilities.update_live_visual_size(e("#"+i)),this.internalIndex++}Rexpansive_Builder_Admin_Utilities.launchTooltips()}}return{Section:i}}(jQuery);
/*!
 * Rexpansive builder
 * 
 */
!function(e){"use strict";var t=function(){function t(e){if(b)return void b.open();var t=wp.media.controller.Library.extend({defaults:_.defaults({id:"upload-block-bg",title:"Upload Background",allowLocalEdits:!0,displaySettings:!0,displayUserSettings:!0,multiple:!1,library:wp.media.query({type:"image"}),type:"image"},wp.media.controller.Library.prototype.defaults)});b=wp.media({button:{text:"Select"},state:"upload-block-bg",states:[new t]}),b.on("close",function(){var e=b.state("upload-block-bg").get("selection");!e.length}),b.on("select",function(){var t=b.state("upload-block-bg"),a=t.get("selection");a&&a.each(function(a){var i,o,r=t.display(a).toJSON(),l=a.toJSON(),d=l.caption;wp.media.view.settings.captions||delete l.caption,r=wp.media.string.props(r,l),i={id:l.id,post_content:l.description,post_excerpt:d},r.linkUrl&&(i.url=r.linkUrl),"image"===l.type||("video"===l.type?o=wp.media.string.video(r,l):"audio"===l.type?o=wp.media.string.audio(r,l):(o=wp.media.string.link(r),i.post_title=r.title)),a.attributes.nonce=wp.media.view.settings.nonce.sendToEditor,a.attributes.attachment=i,a.attributes.html=o,a.attributes.post_id=wp.media.view.settings.post.id,e.val(l.id),R.$image_url.val(l.url),R.$image_id.val(l.id),R.$image_size.val(r.size),R.$image_preview.css("background-image","url("+l.url+")"),R.$image_preview_icon.hide(),R.$type_image.prop("checked",!0)})}),b.on("open",function(){var e,t=b.state("upload-block-bg").get("selection");t.each(function(a){e=wp.media.attachment(a.attributes.id),e.fetch(),t.remove(e?[e]:[])}),R.$image_id.val()&&(e=wp.media.attachment(R.$image_id.val()),e.fetch(),t.add(e?[e]:[]))}),b.open()}function a(e){if(f)return void f.open();var t=wp.media.controller.Library.extend({defaults:_.defaults({id:"upload-block-video",title:"Upload Video",allowLocalEdits:!0,displaySettings:!0,displayUserSettings:!0,multiple:!1,library:wp.media.query({type:"video"}),type:"video"},wp.media.controller.Library.prototype.defaults)});f=wp.media({button:{text:"Select"},state:"upload-block-video",states:[new t]}),f.on("close",function(){var e=f.state("upload-block-video").get("selection");(0==e.length||1==e.length&&""==R.$video_mp4_id.val())&&(R.$video_mp4_id.val(""),R.$video_mp4.prop("checked",!1))}),f.on("select",function(){var e=f.state("upload-block-video"),t=e.get("selection");t&&t.each(function(t){var a,i,o=e.display(t).toJSON(),r=t.toJSON(),l=r.caption;wp.media.view.settings.captions||delete r.caption,o=wp.media.string.props(o,r),a={id:r.id,post_content:r.description,post_excerpt:l},o.linkUrl&&(a.url=o.linkUrl),"image"===r.type||("video"===r.type?i=wp.media.string.video(o,r):"audio"===r.type?i=wp.media.string.audio(o,r):(i=wp.media.string.link(o),a.post_title=o.title)),t.attributes.nonce=wp.media.view.settings.nonce.sendToEditor,t.attributes.attachment=a,t.attributes.html=i,t.attributes.post_id=wp.media.view.settings.post.id,R.$video_mp4.prop("checked",!0),R.$video_mp4_id.val(r.id)})}),f.on("open",function(){var e,t=f.state("upload-block-video").get("selection");t.each(function(a){e=wp.media.attachment(a.attributes.id),e.fetch(),t.remove(e?[e]:[])}),""!=R.$video_mp4_id.val()&&(e=wp.media.attachment(R.$video_mp4_id.val()),e.fetch(),t.add(e?[e]:[]))}),f.open()}function i(e){if($)return void $.open();var t=wp.media.controller.Library.extend({defaults:_.defaults({id:"upload-exp-background",title:"Upload Expand Background",allowLocalEdits:!0,displaySettings:!0,displayUserSettings:!0,multiple:!1,library:wp.media.query({type:"image"}),type:"image"},wp.media.controller.Library.prototype.defaults)});$=wp.media({button:{text:"Select"},state:"upload-exp-background",states:[new t]}),$.on("close",function(){var t=$.state("upload-exp-background").get("selection");t.length||(e.val(""),e.attr("data-image_id",""))}),$.on("select",function(){var t=$.state("upload-exp-background"),a=t.get("selection");a&&a.each(function(a){var i,o,r=t.display(a).toJSON(),l=a.toJSON(),d=l.caption;wp.media.view.settings.captions||delete l.caption,r=wp.media.string.props(r,l),i={id:l.id,post_content:l.description,post_excerpt:d},r.linkUrl&&(i.url=r.linkUrl),"image"===l.type||("video"===l.type?o=wp.media.string.video(r,l):"audio"===l.type?o=wp.media.string.audio(r,l):(o=wp.media.string.link(r),i.post_title=r.title)),a.attributes.nonce=wp.media.view.settings.nonce.sendToEditor,a.attributes.attachment=i,a.attributes.html=o,a.attributes.post_id=wp.media.view.settings.post.id,e.val(l.url),e.attr("data-image_id",l.id)})}),$.on("open",function(){var t,a=$.state("upload-exp-background").get("selection");a.each(function(e){var t=wp.media.attachment(e.attributes.id);t.fetch(),a.remove(t?[t]:[])}),t=wp.media.attachment(e.attr("data-image_id")),t.fetch(),a.add(t?[t]:[])}),$.open()}function o(e){if(w)return void w.open();var t=wp.media.controller.Library.extend({defaults:_.defaults({id:"upload-exp-icon",title:"Upload Expand Icon",allowLocalEdits:!0,displaySettings:!0,displayUserSettings:!0,multiple:!1,type:"image"},wp.media.controller.Library.prototype.defaults)});w=wp.media({button:{text:"Select"},state:"upload-exp-icon",states:[new t]}),w.on("close",function(){var t=w.state("upload-exp-icon").get("selection");t.length||(e.val(""),e.attr("data-icon_id",""))}),w.on("select",function(){var t=w.state("upload-exp-icon"),a=t.get("selection");a&&a.each(function(a){var i,o,r=t.display(a).toJSON(),l=a.toJSON(),d=l.caption;wp.media.view.settings.captions||delete l.caption,r=wp.media.string.props(r,l),i={id:l.id,post_content:l.description,post_excerpt:d},r.linkUrl&&(i.url=r.linkUrl),"image"===l.type||("video"===l.type?o=wp.media.string.video(r,l):"audio"===l.type?o=wp.media.string.audio(r,l):(o=wp.media.string.link(r),i.post_title=r.title)),a.attributes.nonce=wp.media.view.settings.nonce.sendToEditor,a.attributes.attachment=i,a.attributes.html=o,a.attributes.post_id=wp.media.view.settings.post.id,e.val(l.url),e.attr("data-icon_id",l.id)})}),w.on("open",function(){var t,a=w.state("upload-exp-icon").get("selection");a.each(function(e){var t=wp.media.attachment(e.attributes.id);t.fetch(),a.remove(t?[t]:[])}),t=wp.media.attachment(e.attr("data-icon_id")),t.fetch(),a.add(t?[t]:[])}),w.open()}function r(e){if(x)return void x.open();var t=wp.media.controller.Library.extend({defaults:_.defaults({id:"upload-zak-foreground",title:"Upload Foreground Image",allowLocalEdits:!0,displaySettings:!0,displayUserSettings:!0,multiple:!1,type:"image"},wp.media.controller.Library.prototype.defaults)});x=wp.media({button:{text:"Select"},state:"upload-zak-foreground",states:[new t]}),x.on("close",function(){var t=x.state("upload-zak-foreground").get("selection");t.length||(e.val(""),e.attr("data-foreground-id",""))}),x.on("select",function(){var t=x.state("upload-zak-foreground"),a=t.get("selection");a&&a.each(function(a){var i,o,r=t.display(a).toJSON(),l=a.toJSON(),d=l.caption;wp.media.view.settings.captions||delete l.caption,r=wp.media.string.props(r,l),i={id:l.id,post_content:l.description,post_excerpt:d},r.linkUrl&&(i.url=r.linkUrl),"image"===l.type||("video"===l.type?o=wp.media.string.video(r,l):"audio"===l.type?o=wp.media.string.audio(r,l):(o=wp.media.string.link(r),i.post_title=r.title)),a.attributes.nonce=wp.media.view.settings.nonce.sendToEditor,a.attributes.attachment=i,a.attributes.html=o,a.attributes.post_id=wp.media.view.settings.post.id,e.val(l.url),e.attr("data-foreground-id",l.id)})}),x.on("open",function(){var t=x.state("upload-zak-foreground").get("selection");t.each(function(e){var a=wp.media.attachment(e.attributes.id);a.fetch(),t.remove(a?[a]:[])});var a=wp.media.attachment(e.attr("data-foreground-id"));a.fetch(),t.add(a?[a]:[])}),x.open()}function l(e,t,a){if(a="undefined"!=typeof a?a:null,h)return h.state("upload-slide").set("$data",e),h.state("upload-slide").set("$preview",t),h.state("upload-slide").set("image_id",a),void h.open();var i=wp.media.controller.Library.extend({defaults:_.defaults({id:"upload-slide",title:"Select Slide Image",allowLocalEdits:!0,displaySettings:!0,displayUserSettings:!0,multiple:!1,library:wp.media.query({type:"image"}),type:"image",$data:e,$preview:t,image_id:a},wp.media.controller.Library.prototype.defaults)});h=wp.media({button:{text:"Select"},state:"upload-slide",states:[new i]}),h.on("close",function(){var t=h.state("upload-slide").get("selection");0==t.length&&e.val()}),h.on("select",function(){var e=h.state("upload-slide"),t=e.get("selection");t&&t.each(function(t){var a,i,o=e.display(t).toJSON(),r=t.toJSON(),l=r.caption;wp.media.view.settings.captions||delete r.caption,o=wp.media.string.props(o,r),a={id:r.id,post_content:r.description,post_excerpt:l},o.linkUrl&&(a.url=o.linkUrl),"image"===r.type||("video"===r.type?i=wp.media.string.video(o,r):"audio"===r.type?i=wp.media.string.audio(o,r):(i=wp.media.string.link(o),a.post_title=o.title)),t.attributes.nonce=wp.media.view.settings.nonce.sendToEditor,t.attributes.attachment=a,t.attributes.html=i,t.attributes.post_id=wp.media.view.settings.post.id,h.state("upload-slide").get("$data").val(r.id),h.state("upload-slide").get("$preview").css("backgroundImage","url("+r.url+")").addClass("rex-slider__slide__image-preview--active")})}),h.on("open",function(){var e,t=h.state("upload-slide").get("selection");t.each(function(a){e=wp.media.attachment(a.attributes.id),e.fetch(),t.remove(e?[e]:[])});var a=h.state("upload-slide").get("image_id");a&&(e=wp.media.attachment(a),e.fetch(),t.add(e?[e]:[]))}),h.open()}function d(e){if(k)return k.state("upload-slide-video").set("$data",e),void k.open();var t=wp.media.controller.Library.extend({defaults:_.defaults({id:"upload-slide-video",title:"Select Slide Image",allowLocalEdits:!0,displaySettings:!0,displayUserSettings:!0,multiple:!1,library:wp.media.query({type:"video"}),type:"video",$data:e},wp.media.controller.Library.prototype.defaults)});k=wp.media({button:{text:"Select"},state:"upload-slide-video",states:[new t]}),k.on("close",function(){var t=k.state("upload-slide-video").get("selection");0==t.length&&e.val()}),k.on("select",function(){var e=k.state("upload-slide-video"),t=e.get("selection");t&&t.each(function(t){var a,i,o=e.display(t).toJSON(),r=t.toJSON(),l=r.caption;wp.media.view.settings.captions||delete r.caption,o=wp.media.string.props(o,r),a={id:r.id,post_content:r.description,post_excerpt:l},o.linkUrl&&(a.url=o.linkUrl),"image"===r.type||("video"===r.type?i=wp.media.string.video(o,r):"audio"===r.type?i=wp.media.string.audio(o,r):(i=wp.media.string.link(o),a.post_title=o.title)),t.attributes.nonce=wp.media.view.settings.nonce.sendToEditor,t.attributes.attachment=a,t.attributes.html=i,t.attributes.post_id=wp.media.view.settings.post.id,k.state("upload-slide-video").get("$data").val(r.id)})}),k.on("open",function(){var e,t=k.state("upload-slide-video").get("selection");t.each(function(a){e=wp.media.attachment(a.attributes.id),e.fetch(),t.remove(e?[e]:[])});var a=k.state("upload-slide-video").get("$data").val();a&&(e=wp.media.attachment(a),e.fetch(),t.add(e?[e]:[]))}),k.open()}e(".rex-modal-draggable").draggable({cancel:"input,textarea,button,select,option,.rex-check-icon, .input-field, .rex-slider__slide-edit, #rex-css-ace-editor, label"}),Rexpansive_Builder_Admin_Config.init(),Rexpansive_Builder_Admin_Utilities.init(),Rexpansive_Builder_Admin_Hooks.init(),Rexpansive_Builder_Admin_Templates.init(),Rexpansive_Builder_Admin_Lightbox.init(),Rexpansive_Builder_Admin_Rxcf.init(),Rexpansive_Builder_Admin_PositionEditor.init(),Rexpansive_Builder_Admin_PaddingEditor.init(),Rexpansive_Builder_Admin_TextEditor.init(),Rexpansive_Builder_Admin_VideoEditor.init(),Rexpansive_Builder_Admin_ModelEditor.init(),Rexpansive_Builder_Admin_Config.$builderArea.on("rexpansive-builder.open-slider-editor",function(e){N()}),Rexpansive_Builder_Admin_Config.$builderArea.on("rexpansive-builder.open-zak-editor",function(e,t,a){F(t,a)});var n=e("#rexeditor-modal"),s=n.parent(".rex-modal-wrap"),c=e("#rexeditor-expand-modal"),p=c.parent(".rex-modal-wrap"),u=e("#builder-area"),v=e("#page_template"),m=e("#rexbuilder").parent(".meta-box-sortables").width(),g={grid_area_width:m-46,grid_columns:12,widget_margins:8,widget_dimension:null};g.widget_dimension=Math.round((g.grid_area_width-g.widget_margins*(2*g.grid_columns))/g.grid_columns);var b,f,h,k,$,w,x,y={$open_button:e("#rex-open-ace-css-editor"),$modal:e("#rex-css-editor"),$modal_wrap:null,$save_button:e("#css-editor-save"),$cancel_button:e("#css-editor-cancel")};y.$modal_wrap=y.$modal.parent(".rex-modal-wrap");var C=e("textarea[id=_rexbuilder_custom_css]"),A=ace.edit("rex-css-ace-editor");A.setTheme("ace/theme/monokai"),A.getSession().setMode("ace/mode/css"),y.$open_button.on("click",function(e){e.preventDefault(),""!==C.text()&&(A.setValue(C.text()),A.clearSelection()),Rexpansive_Builder_Admin_Modals.OpenModal(y.$modal_wrap)}),y.$save_button.on("click",function(e){e.preventDefault(),C.text(A.getValue()),Rexpansive_Builder_Admin_Modals.CloseModal(y.$modal_wrap)}),y.$cancel_button.on("click",function(e){e.preventDefault(),Rexpansive_Builder_Admin_Modals.CloseModal(y.$modal_wrap)});var R={isset:!1,$modal:null,$background_type:null,$type_image:e("#background-value-image"),$image_preview:null,$image_preview_icon:null,$image_url:null,$image_id:null,$image_type_wrap:null,$image_type:null,$image_size:e("#set-image-size-value"),$type_color:e("#background-value-color"),$color_runtime_value:e("#background-block-color-runtime"),$color_value:e("#background-block-color"),$color_preview:null,$color_preview_icon:e("#background-preview-icon"),$color_palette_wrap:e("#bg-color-palette"),$color_palette_buttons:e("#bg-color-palette .bg-palette-selector"),$video_choose:e(".rex-block-choose-video"),$video_upload:e("#rex-block-upload-mp4"),$video_mp4:e("#rex-block-choose-mp4"),$video_mp4_id:e("#rex-block-mp4-id"),$video_youtube:e("#rex-block-choose-youtube"),$video_youtube_url:e("#rex-block-youtube-url"),$video_youtube_label:e("#rex-block-youtube-url-label"),$video_vimeo:e("#rex-block-choose-vimeo"),$video_vimeo_url:e("#rex-block-vimeo-url"),$video_vimeo_label:e("#rex-block-vimeo-url-label"),$video_has_audio_wrap:e("#block-set-video-has-audio"),$video_has_audio:e("#rex-block-video-has-audio"),$save_button:e("#background_set_save"),$cancel_button:null,$zoom_wrap:e("#bg-set-photoswipe"),$has_zoom:e("#background_photoswipe"),$link_wrap:e("#bg-set-link-wrap"),$has_link:e("#block_has_link"),$link_value:e("#block_link_value"),$class_wrap:e("#block-set-class-wrap"),$class_value:e("#block_custom_class"),$padding_wrap:e("#block-set-padding-wrap"),$positions:e("#background_block_set .content-position"),$block_padding_top:e("#bm-block-padding-top"),$block_padding_right:e("#bm-block-padding-right"),$block_padding_bottom:e("#bm-block-padding-bottom"),$block_padding_left:e("#bm-block-padding-left"),$block_padding_type_pixel:e(".bm-block-padding-type[value=pixel]"),$block_padding_type_percentage:e(".bm-block-padding-type[value=percentage]"),$overlay_color_value:e("#overlay-color-block-value"),$overlay_color_palette_buttons:e("#bg-overlay-block-color-palette .bg-palette-selector"),$overlay_color_preview_icon:e("#overlay-block-preview-icon"),$has_overlay_group:e(".block-has-overlay"),$has_overlay_small:e("#block-has-overlay-small"),$has_overlay_medium:e("#block-has-overlay-medium"),$has_overlay_large:e("#block-has-overlay-large")};R.$color_value.spectrum({replacerClassName:"btn-floating",preferredFormat:"hex",showPalette:!1,showAlpha:!0,showInput:!0,containerClassName:"rexbuilder-materialize-wrap block-background-color-picker",show:function(e){R.$type_color.prop("checked",!0),""===R.$color_runtime_value.val()&&R.$color_value.spectrum("set","#ffffff")},move:function(e){R.$color_preview_icon.hide()},change:function(e){R.$color_palette_buttons.removeClass("palette-color-active")},cancelText:"",chooseText:""}),e(".block-background-color-picker .sp-cancel").on("click",function(){var t=R.$save_button.attr("data-block_id"),a=R.$save_button.attr("data-section_id"),i="";if(""!=t?i=e("#"+t).attr("data-bg_settings"):""!=a&&(i=e(".builder-row[data-count="+a+"]").attr("data-gridproperties")),""===i)R.$color_runtime_value.val(""),R.$color_preview_icon.show();else{var o=JSON.parse(i).color;""===o?(R.$color_runtime_value.val(""),R.$color_preview_icon.show()):R.$color_runtime_value.val(o)}}),e(".block-background-color-picker .sp-choose").on("click",function(){R.$color_preview_icon.hide(),R.$color_runtime_value.val(R.$color_value.spectrum("get"))}),R.$color_palette_buttons.on("click",function(t){e(t.currentTarget).addClass("palette-color-active"),R.$color_preview_icon.hide(),R.$color_palette_buttons.not(t.currentTarget).removeClass("palette-color-active"),R.$type_color.prop("checked",!0),R.$color_value.spectrum("set",e(t.currentTarget).find(".bg-palette-value").val()),R.$color_runtime_value.val(e(t.currentTarget).find(".bg-palette-value").val())}),R.$overlay_color_value.spectrum({replacerClassName:"btn-floating",preferredFormat:"hex",showPalette:!1,showAlpha:!0,showInput:!0,containerClassName:"rexbuilder-materialize-wrap block-overlay-color-picker",move:function(e){R.$overlay_color_preview_icon.hide()},change:function(e){R.$overlay_color_palette_buttons.removeClass("palette-color-active")},cancelText:"",chooseText:""}),R.$color_preview_icon.on("click",function(){return R.$color_value.spectrum("show"),!1}),R.$overlay_color_preview_icon.on("click",function(){return R.$overlay_color_value.spectrum("show"),!1}),R.$overlay_color_palette_buttons.on("click",function(t){e(t.currentTarget).addClass("palette-color-active"),R.$overlay_color_preview_icon.hide(),R.$overlay_color_palette_buttons.not(t.currentTarget).removeClass("palette-color-active"),R.$overlay_color_value.spectrum("set",e(t.currentTarget).find(".bg-palette-value").val())}),e(".block-overlay-color-picker .sp-choose").on("click",function(){R.$overlay_color_preview_icon.hide()}),R.$video_youtube_url.on("change keyup paste",function(){""!=e(this).val()?R.$video_youtube.attr("checked",!0):R.$video_youtube.attr("checked",!1)}),R.$video_vimeo_url.on("change keyup paste",function(){""!=e(this).val()?R.$video_vimeo.attr("checked",!0):R.$video_vimeo.attr("checked",!1)});var B={$section_layout_type:e(".builder-edit-row-layout"),$section_fixed:e("#section-fixed"),$section_masonry:e("#section-masonry"),$section_full:e("#section-full-modal"),$section_boxed:e("#section-boxed-modal"),$section_boxed_width:e(".section-set-boxed-width"),$section_boxed_width_type:e(".section-width-type"),$has_overlay_small:e("#section-has-overlay-small"),$has_overlay_medium:e("#section-has-overlay-medium"),$has_overlay_large:e("#section-has-overlay-large"),$color_value:e(".backresponsive-color-section"),$color_palette_buttons:e("#bg-overlay-color-palette .bg-palette-selector"),$color_preview_icon:e("#overlay-preview-icon"),$is_full:e("#section-is-full"),$hold_grid:e("#rx-hold-grid"),$section_id:e("#sectionid-container"),$save_button:e("#backresponsive-set-save"),$block_gutter:e(".section-set-block-gutter"),$row_separator_top:e("#row-separator-top"),$row_separator_right:e("#row-separator-right"),$row_separator_bottom:e("#row-separator-bottom"),$row_separator_left:e("#row-separator-left"),$row_margin_top:e("#row-margin-top"),$row_margin_right:e("#row-margin-right"),$row_margin_bottom:e("#row-margin-bottom"),$row_margin_left:e("#row-margin-left"),$section_active_photoswipe:e("#section-active-photoswipe"),section_photoswipe_changed:!1};B.$color_value.spectrum({replacerClassName:"btn-floating",showInput:!0,preferredFormat:"hex",showAlpha:!0,cancelText:"",chooseText:"",containerClassName:"rexbuilder-materialize-wrap section-overlay-color-picker",move:function(e){B.$color_preview_icon.hide()},change:function(e){B.$color_palette_buttons.removeClass("palette-color-active")}}),B.$color_preview_icon.on("click",function(){return B.$color_value.spectrum("show"),!1}),B.$color_palette_buttons.on("click",function(t){e(t.currentTarget).addClass("palette-color-active"),B.$color_preview_icon.hide(),B.$color_palette_buttons.not(t.currentTarget).removeClass("palette-color-active"),B.$color_value.spectrum("set",e(t.currentTarget).find(".bg-palette-value").val())}),B.$section_full.on("click",function(){B.$section_boxed_width.val("100"),B.$section_boxed_width_type.filter('[value="percentage"]').prop("checked",!0)}),B.$section_boxed.on("click",function(){var t=B.$save_button.attr("data-section_id"),a=e(".builder-row[data-count="+t+"]"),i="";if(""!==a.attr("data-backresponsive")&&(i=JSON.parse(a.attr("data-backresponsive"))),""!=i){var o=i.section_width.replace(/(%|px)/g,"");""!=o?B.$section_boxed_width.val(o):B.$section_boxed_width.val("80")}B.$section_boxed_width_type.filter('[value="percentage"]').prop("checked",!0)}),B.$section_boxed_width.on("change keyup paste",function(){var t=e(this).val(),a=B.$section_boxed_width_type.filter(":checked");"100"==t&&"percentage"==a.val()?B.$section_full.prop("checked",!0):B.$section_boxed.prop("checked",!0)}),B.$section_boxed_width_type.on("click",function(){var t=e(this).val();"pixel"==t?B.$section_boxed.prop("checked",!0):"percentage"==t&&"100"==B.$section_boxed_width.val()&&B.$section_full.prop("checked",!0)}),B.$section_active_photoswipe.on("change",function(t){var a=e(t.target).parents("#modal-background-responsive-set").find("#backresponsive-set-save").attr("data-section_id"),i=e(".builder-row[data-count="+a+"]").attr("data-section-active-photoswipe");i="undefined"!=typeof i&&"1"==i,q(i,B.$section_active_photoswipe.prop("checked"))?B.section_photoswipe_changed=!0:B.section_photoswipe_changed=!1}),e(".section-overlay-color-picker .sp-choose").on("click",function(){B.$color_preview_icon.hide()}),e(window).on("scroll",function(){R.$color_value.spectrum("reflow"),R.$overlay_color_value.spectrum("reflow"),B.$color_value.spectrum("reflow")}),e(".sp-container .sp-button-container .sp-cancel").append('<i class="rex-icon">n</i>'),e(".sp-container .sp-button-container .sp-choose").append('<i class="rex-icon">m</i>'),e(".sp-container .sp-input-container").append('<span class="rex-material-bar"></span>');var S=e("#rex-slider__new-slide-tmpl").html().trim(),M={$modal:e("#rex-slider-block"),$modal_wrap:null,$cancel_button:null,$save_button:null,$add_new_slide:null,$slide_list:null,$slider_autostart:null,$slider_prev_next:null,$slider_dots:null,$slider_import:null};M.$modal_wrap=M.$modal.parent(".rex-modal-wrap"),M.$cancel_button=M.$modal.find(".rex-cancel-button"),M.$save_button=M.$modal.find(".rex-save-button"),M.$add_new_slide=M.$modal.find("#rex-slider__add-new-slide"),M.$slide_list=M.$modal.find(".rex-slider__slide-list"),M.$slider_autostart=M.$modal.find("#rex-slider__autostart"),M.$slider_prev_next=M.$modal.find("#rex-slider__prev-next"),M.$slider_dots=M.$modal.find("#rex-slider__dots"),M.$slider_import=M.$modal.find("#rex-slider__import"),M.$slide_list.sortable({revert:!0,handle:".rex-slider__slide-edit[value=move]",update:function(e,t){O(e,t)}});var z={$modal:e("#rex-slider__links-editor"),$modal_wrap:null,$cancel_button:null,$save_button:null,visibility_classes:["video-links--visible","url-links--visible"],$link_value:null,$video_type:null,$video_youtube:null,$video_mp4:null,$video_mpa_add:null,$video_vimeo:null,$video_audio:null};z.$modal_wrap=z.$modal.parent(".rex-modal-wrap"),z.$cancel_button=z.$modal.find(".rex-cancel-button"),z.$save_button=z.$modal.find(".rex-save-button"),z.$link_value=z.$modal.find("#rex-slider__slide-url-link"),z.$video_type=z.$modal.find("input[name=rex-slide-choose-video]"),z.$video_mpa_add=z.$modal.find("#rex-slide-choose-mp4"),z.$video_youtube=z.$modal.find("#rex-slide__video-youtube"),z.$video_mp4=z.$modal.find("#rex-slide__video-mp4"),z.$video_vimeo=z.$modal.find("#rex-slide__video-vimeo"),z.$video_audio=z.$modal.find("#rex-slide__video--audio"),z.$video_youtube.on("change keyup paste",function(){""!=e(this).val()?z.$video_type.filter("[value=youtube]").attr("checked",!0):z.$video_type.filter("[value=youtube]").attr("checked",!1)}),z.$video_vimeo.on("change keyup paste",function(){""!=e(this).val()?z.$video_type.filter("[value=vimeo]").attr("checked",!0):z.$video_type.filter("[value=vimeo]").attr("checked",!1)}),e(document).on("click",".rex-slider__slide-edit",function(t){t.preventDefault();var a=e(this),i=a.parents(".rex-slider__slide"),o=i.find(".rex-slider__slide-data"),r=a.attr("value"),d=i.attr("data-slider-slide-id");switch(r){case"add-slide":var n=o.find("input[name=rex-slider--slide-id]"),s=i.find(".rex-slider__slide__image-preview");l(n,s);break;case"edit-slide":var n=o.find("input[name=rex-slider--slide-id]"),s=i.find(".rex-slider__slide__image-preview"),c=n.val();l(n,s,c);break;case"text":var p=o.find("textarea[name=rex-slider--slide-text]"),_=p.text(),u=".rex-slider__slide[data-slider-slide-id="+d+"]";Rexpansive_Builder_Admin_TextEditor.openTextEditor(u,_,!0,["hide-padding-position"]);break;case"video":M.$modal.addClass("push-down-modal"),E("video",".rex-slider__slide[data-slider-slide-id="+d+"]");break;case"url":M.$modal.addClass("push-down-modal"),E("url",".rex-slider__slide[data-slider-slide-id="+d+"]");break;case"copy":var v=parseInt(M.$modal.find(".rex-slider__slide").length),m=i.clone();m.attr("data-slider-slide-id",v),m.find(".rex-slider__slide-index").text(v+1),M.$slide_list.append(m),M.$slide_list.sortable("refresh"),Rexpansive_Builder_Admin_Utilities.resetModalDimensions(M.$modal);break;case"delete":i.remove(),M.$modal.find(".rex-slider__slide").each(function(t,a){e(a).attr("data-slider-slide-id",t).find(".rex-slider__slide-index").text(t+1)}),Rexpansive_Builder_Admin_Utilities.resetModalDimensions(M.$modal)}}),M.$add_new_slide.on("click",function(){var e=parseInt(M.$modal.find(".rex-slider__slide").length),t=S.replace(/\bdata.slideindex\b/g,e).replace(/\bdata.slideindexfront\b/g,e+1);M.$slide_list.append(t),M.$slide_list.sortable("refresh"),Rexpansive_Builder_Admin_Utilities.resetModalDimensions(M.$modal)}),M.$cancel_button.on("click",function(){Rexpansive_Builder_Admin_Modals.CloseModal(M.$modal_wrap)}),M.$save_button.on("click",function(){var t=D(),a=e(this).attr("data-block-to-edit"),i=e(this).attr("data-slider-to-edit");i?e.ajax({type:"POST",dataType:"json",url:rexajax.ajaxurl,data:{action:"rex_edit_slider_from_builder",nonce_param:rexajax.rexnonce,slider_data:t,slider_id:i},success:function(t){if(t.success){var i='[RexSlider slider_id="'+t.data.slider_id+'"]';if(a)e(a).find(".element-preview").empty().append(i.replace(/'/gi,"’")),e(a).find(".data-text-content").text(i.replace(/'/gi,"’")),e(a).attr("data-block-slider-id",t.data.slider_id);else{var o=I("rexslider",12,4),r=e("#"+o);r.find(".element-actions").addClass("element-actions__block-slider"),r.find(".element-preview").empty().append(i.replace(/'/gi,"’")),r.find(".data-text-content").text(i.replace(/'/gi,"’")),r.attr("data-block-slider-id",t.data.slider_id)}}},error:function(e){}}):e.ajax({type:"POST",dataType:"json",url:rexajax.ajaxurl,data:{action:"rex_create_slider_from_builder",nonce_param:rexajax.rexnonce,slider_data:t},success:function(t){if(t.success){var i='[RexSlider slider_id="'+t.data.slider_id+'"]';if(a)e(a).find(".element-preview").empty().append(i.replace(/'/gi,"’")),e(a).find(".data-text-content").text(i.replace(/'/gi,"’")),e(a).attr("data-block-slider-id",t.data.slider_id);else{var o=I("rexslider",12,4),r=e("#"+o);r.find(".element-actions").addClass("element-actions__block-slider"),r.find(".element-preview").empty().append(i.replace(/'/gi,"’")),r.find(".data-text-content").text(i.replace(/'/gi,"’")),r.attr("data-block-slider-id",t.data.slider_id)}M.$slider_import.append('<option value="'+t.data.slider_id+'">'+t.data.slider_title+"</option>")}},error:function(e){}}),Rexpansive_Builder_Admin_Modals.CloseModal(M.$modal_wrap)}),M.$slider_import.on("change",function(t){t.preventDefault();var a=e(this).val();if("0"!=a)M.$modal.addClass("rex-modal--loading"),e.ajax({type:"POST",url:rexajax.ajaxurl,data:{action:"rex_create_rexslider_admin_markup",nonce_param:rexajax.rexnonce,slider_id:a},success:function(e){T(e.data.rexslider_attrs),M.$slide_list.empty().append(e.data.slides_markup),M.$slide_list.sortable("refresh"),M.$save_button.attr("data-slider-to-edit",a),M.$modal.removeClass("rex-modal--loading"),Rexpansive_Builder_Admin_Utilities.resetModalDimensions(M.$modal)},error:function(e){M.$modal.removeClass("rex-modal--loading")}});else{M.$save_button.attr("data-slider-to-edit",""),M.$slide_list.empty(),M.$slider_autostart.prop("checked",!0),M.$slider_prev_next.prop("checked",!0),M.$slider_dots.prop("checked",!0);var i=0,o=S.replace(/\bdata.slideindex\b/g,i).replace(/\bdata.slideindexfront\b/g,i+1);M.$slide_list.append(o),M.$slide_list.sortable("refresh"),Rexpansive_Builder_Admin_Utilities.resetModalDimensions(M.$modal)}});var D=function(){var t={slides:[],settings:{}},a=M.$modal.find(".rex-slider__slide");return a.length>0&&(t.settings.auto_start=M.$slider_autostart.prop("checked"),t.settings.prev_next=M.$slider_prev_next.prop("checked"),t.settings.dots=M.$slider_dots.prop("checked"),a.each(function(a,i){var o=e(i),r={slide_image_id:o.find("input[name=rex-slider--slide-id]").val(),slide_text:o.find("textarea[name=rex-slider--slide-text]").text(),slide_video:o.find("input[name=rex-slider--slide-video-url]").val(),slide_video_type:o.find("input[name=rex-slider--slide-video-type]").val(),slide_video_audio:o.find("input[name=rex-slider--slide-video-audio]").val(),slide_url:o.find("input[name=rex-slider--slide-url]").val()};t.slides.push(r)})),t};z.$cancel_button.on("click",function(){M.$modal.removeClass("push-down-modal"),Rexpansive_Builder_Admin_Modals.CloseModal(z.$modal_wrap,!0)});var O=function(t,a){var i=e(a.item).siblings().add(e(a.item));i.each(function(t,a){e(a).attr("data-slider-slide-id",t).find(".rex-slider__slide-index").text(t+1)})},E=function(t,a){switch(z.$modal.removeClass(z.visibility_classes.join(" ")),z.$save_button.val("").val(a),t){case"video":z.$video_type.prop("checked",!1),z.$video_audio.prop("checked",!1),z.$video_youtube.val("").next().removeClass("active"),z.$video_mp4.val(""),z.$video_vimeo.val("").next().removeClass("active");var i=e(a).find("input[name=rex-slider--slide-video-type]").val(),o=e(a).find("input[name=rex-slider--slide-video-url]").val(),r=e(a).find("input[name=rex-slider--slide-video-audio]").val();if(o&&i)switch(z.$video_type.filter("[value="+i+"]").prop("checked",!0),z.$video_audio.prop("checked",r),i){case"youtube":z.$video_youtube.val(o).next().addClass("active");break;case"mp4":z.$video_mp4.val(o);break;case"vimeo":z.$video_vimeo.val(o).next().addClass("active")}z.$modal.addClass("video-links--visible");break;case"url":z.$link_value.val("").next().removeClass("active");var o=e(a).find("input[name=rex-slider--slide-url]").val();o&&z.$link_value.val(o).next().addClass("active"),z.$modal.addClass("url-links--visible")}Rexpansive_Builder_Admin_Modals.OpenModal(z.$modal_wrap,!0)};z.$save_button.on("click",function(){var t=e(this).val();if(z.$modal.hasClass("video-links--visible")){var a=z.$video_type.filter(":checked").val();e(t).find("input[name=rex-slider--slide-video-type]").val(a);var i="";switch(a){case"youtube":i=z.$video_youtube.val();break;case"mp4":i=z.$video_mp4.val();break;case"vimeo":i=z.$video_vimeo.val()}""!=i?(e(t).find("input[name=rex-slider--slide-video-url]").val(i),e(t).find(".rex-slider__slide-edit[value=video]").addClass("rex-slider__slide-edit__field-active-notice")):e(t).find(".rex-slider__slide-edit[value=video]").removeClass("rex-slider__slide-edit__field-active-notice"),e(t).find("input[name=rex-slider--slide-video-audio]").val(z.$video_audio.prop("checked"))}else if(z.$modal.hasClass("url-links--visible")){var o=z.$link_value.val();""!=o?(e(t).find("input[name=rex-slider--slide-url]").val(o),e(t).find(".rex-slider__slide-edit[value=url]").addClass("rex-slider__slide-edit__field-active-notice")):(e(t).find("input[name=rex-slider--slide-url]").val(""),e(t).find(".rex-slider__slide-edit[value=url]").removeClass("rex-slider__slide-edit__field-active-notice"))}M.$modal.removeClass("push-down-modal"),Rexpansive_Builder_Admin_Modals.CloseModal(z.$modal_wrap,!0);
}),z.$video_mpa_add.on("click",function(e){d(z.$video_mp4)});var T=function(e){M.$slider_autostart.prop("checked",!1),M.$slider_prev_next.prop("checked",!1),M.$slider_dots.prop("checked",!1);for(var t in e)if(e.hasOwnProperty(t)){var a=e[t];switch(t){case"auto_start":"true"==a&&M.$slider_autostart.prop("checked",!0);break;case"prev_next":"true"==a&&M.$slider_prev_next.prop("checked",!0);break;case"dots":"true"==a&&M.$slider_dots.prop("checked",!0)}}},N=function(t,a,i){t="undefined"!=typeof t?t:"",a="undefined"!=typeof a?a:"",i="undefined"!=typeof i?i:"",M.$slider_autostart.prop("checked",!1),M.$slider_prev_next.prop("checked",!1),M.$slider_dots.prop("checked",!1),M.$slide_list.empty(),M.$slider_import.val("0"),M.$modal.removeClass("rex-slider-block--editing"),t&&a&&i?(M.$save_button.attr("data-block-to-edit",t),M.$save_button.attr("data-slider-to-edit",i),M.$slider_import.val(i),M.$modal.addClass("rex-modal--loading"),e.ajax({type:"POST",url:rexajax.ajaxurl,data:{action:"rex_create_rexslider_admin_markup",nonce_param:rexajax.rexnonce,data:a,slider_id:i},success:function(e){e.success&&(T(e.data.rexslider_attrs),M.$slide_list.append(e.data.slides_markup),M.$slide_list.sortable("refresh"),M.$modal.removeClass("rex-modal--loading"))},error:function(e){console.log(e),M.$modal.removeClass("rex-modal--loading")}}),Rexpansive_Builder_Admin_Modals.OpenModal(M.$modal_wrap)):(M.$slider_autostart.prop("checked",!0),M.$slider_prev_next.prop("checked",!0),M.$slider_dots.prop("checked",!0),M.$save_button.attr("data-block-to-edit",""),M.$save_button.attr("data-slider-to-edit",""),M.$slide_list.append(S.replace(/\bdata.slideindex\b/g,"0").replace(/\bdata.slideindexfront\b/g,"1")),M.$slide_list.sortable("refresh"),Rexpansive_Builder_Admin_Modals.OpenModal(M.$modal_wrap))};e(document).on("click",".builder-show-widgets",function(){return!1}),e(".builder-row").each(function(t,a){Rexpansive_Builder_Admin_Config.collect[t]=new Rexpansive_Builder_Admin_Section.Section(e(a),t),Rexpansive_Builder_Admin_Config.collect[t].init(),Rexpansive_Builder_Admin_Config.counter++}),u.sortable({revert:!0,handle:".builder-move-row"});var U=function(){var t,a=u.sortable("instance");if("undefined"!=typeof a&&null!==a&&0!==a.length){var i=u.sortable("toArray",{attribute:"data-gridcontent"}),o=u.sortable("toArray",{attribute:"data-gridproperties"}),r=u.sortable("toArray",{attribute:"data-griddimension"}),l=u.sortable("toArray",{attribute:"data-layout"}),d=u.sortable("toArray",{attribute:"data-sectionid"}),n=u.sortable("toArray",{attribute:"data-section-overlay-color"}),s=u.sortable("toArray",{attribute:"data-backresponsive"}),c=u.sortable("toArray",{attribute:"data-row-separator-top"}),p=u.sortable("toArray",{attribute:"data-row-separator-right"}),_=u.sortable("toArray",{attribute:"data-row-separator-bottom"}),v=u.sortable("toArray",{attribute:"data-row-separator-left"}),m=u.sortable("toArray",{attribute:"data-row-margin-top"}),g=u.sortable("toArray",{attribute:"data-row-margin-right"}),b=u.sortable("toArray",{attribute:"data-row-margin-bottom"}),f=u.sortable("toArray",{attribute:"data-row-margin-left"}),h=u.sortable("toArray",{attribute:"data-section-active-photoswipe"}),k=u.sortable("toArray",{attribute:"data-section-model"});for(t=0;t<i.length;t++)i[t]=P(i[t],o[t],r[t],l[t],d[t],n[t],s[t],c[t],p[t],_[t],v[t],m[t],g[t],b[t],f[t],h[t],k[t]);return i=i.join(""),J(),e(Rexpansive_Builder_Admin_Utilities.meta_box_selector).val(i),i}},J=function(){var t=new Date;e("#_rexbuilder").val(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()))};e(document).on("sectionCollectData",function(t,a){_plugin_backend_settings.activate_builder&&e("#builder-switch").prop("checked")&&(a.collectGridData(),U())}),e(document).on("mouseup",".gridster > ul li.item",function(t){Rexpansive_Builder_Admin_Config.collect[e(this).parents(".builder-row").attr("data-count")]}),e(window).on("resize",function(){var t,a;Rexpansive_Builder_Admin_Config.set_grid_dimensions();var i=e("#rexbuilder").parent(".meta-box-sortables").width();for(t=Math.round((i-46-g.widget_margins*(2*g.grid_columns))/g.grid_columns),g.widget_dimension=t,a=0;a<Rexpansive_Builder_Admin_Config.collect.length;a++){Rexpansive_Builder_Admin_Config.collect[a].sectionRef.find(".gridster > ul").css("width","100%");Rexpansive_Builder_Admin_Config.collect[a].gridRef.resize_widget_dimensions({widget_base_dimensions:[t,t]})}}),e(document).on("click",".item.svg-ripple-effect",function(t){var a=t.pageX,i=t.pageY,o=i-e(this).offset().top,r=a-e(this).offset().left,l=this,d=parseInt(r),n=parseInt(o);e(this).find("svg").remove(),e(this).append('<svg><circle cx="'+d+'" cy="'+n+'" r="0"></circle></svg>');var s=e(l).find("circle"),c=0,p=e(l).outerWidth(),_=e(l).outerHeight();c=p>_?p:_,c=Math.sqrt(p*p+_*_),s.animate({r:c},{specialEasing:"easeOutQuad",duration:Math.floor(.5*c),complete:function(){e(this).animate({opacity:0},{duration:Math.floor(.6*c),specialEasing:"easeOutExpo"})}})});var j=e(".tooltipped"),L=function(){e(".tooltipped").not(j).tooltip({delay:50}),j=e(".tooltipped")},I=function(t,a,i){t="undefined"!=typeof t?t:"text",a="undefined"!=typeof a?a:2,i="undefined"!=typeof i?i:2;var o,r="block_"+Rexpansive_Builder_Admin_Config.global_section_reference.sectIndex+"_"+Rexpansive_Builder_Admin_Config.global_section_reference.internalIndex;return o=Rexpansive_Builder_Admin_Templates.templates.text.replace(/\bdata.imageid\b/g,r).replace(/\bdata.elementactionsplaceholder\b/g,Rexpansive_Builder_Admin_Templates.templates.element_actions).replace(/\bdata.blocktype\b/g,t),Rexpansive_Builder_Admin_Config.global_section_reference.gridRef.add_widget(o,a,i),Rexpansive_Builder_Admin_Utilities.update_live_visual_size(e("#"+r)),Rexpansive_Builder_Admin_Config.global_section_reference.internalIndex++,r},F=function(t,a){var i=tinyMCE.get("rexbuilder_expand_editor"),o=e(".expand-editor-topfields");"undefined"!=typeof t&&null!==t&&(e("#expand-editor-save").val(t),o.find("input:not(.exp-side-holder)").each(function(){e(this).val("")})),"undefined"!=typeof a&&null!==a&&""!==a&&(o.find(".exp-back-holder").val(a.background_url),o.find(".exp-back-holder").attr("data-image_id",a.background_id),o.find(".exp-title-holder").val(a.title),o.find(".exp-icon-holder").val(a.icon_url),o.find(".exp-icon-holder").attr("data-icon_id",a.icon_id),o.find(".exp-side-holder[value="+a.side+"]").prop("checked",!0),o.find(".zak-foreground-holder").val(a.foreground_url),o.find(".zak-foreground-holder").attr("data-foreground-id",a.foreground_id),a=a.content),"undefined"==typeof i||null===i?(e("#rexbuilder_expand_editor").val(a),e("#rexbuilder_expand_editor").text(a)):(i.setContent(a),i.save({no_events:!0})),Rexpansive_Builder_Admin_Modals.OpenModal(p)},P=function(e,t,a,i,o,r,l,d,n,s,c,p,_,u,v,m,g){var b,f,h="";if(h="[RexpansiveSection ",h+=o?'section_name="'+o+'" ':'section_name="" ',t?(b=JSON.parse(t),h+='color_bg_section="'+b.color+'" image_bg_section="'+b.url+'" id_image_bg_section="'+b.image+'" video_bg_url_section="'+b.youtube+'" video_bg_id_section="'+b.video+'" video_bg_url_vimeo_section="'+b.vimeo+'" '):h+='color_bg_section="" image_bg_section="" id_image_bg_section="" ',a?(f=a,h+='dimension="'+f+'" margin="" '):h+='dimension="" margin="" ',h+=i?'layout="'+i+'" ':'layout="" ',l){var k=JSON.parse(l);"rgba("+k.r+","+k.g+","+k.b+","+k.a+")";h+='block_distance="'+k.gutter+'" ',h+='full_height="'+k.isFull+'" ',h+='custom_classes="'+k.custom_classes+'" ',h+='section_width="'+k.section_width+'" '}return h+=r?'responsive_background="'+r+'" ':'responsive_background=""',""!=d&&(h+=' row_separator_top="'+d+'" '),""!=n&&(h+=' row_separator_right="'+n+'" '),""!=s&&(h+=' row_separator_bottom="'+s+'" '),""!=c&&(h+=' row_separator_left="'+c+'" '),""!=p&&(h+=' row_margin_top="'+p+'" '),""!=_&&(h+=' row_margin_right="'+_+'" '),""!=u&&(h+=' row_margin_bottom="'+u+'" '),""!=v&&(h+=' row_margin_left="'+v+'" '),""!=m&&(h+=' row_active_photoswipe="'+m+'" '),""!=g&&(h+=' section_model="'+g+'" '),Rexpansive_Builder_Admin_Utilities.builderlive&&(h+=' edit_from_backend="true"'),h+="]"+e+"[/RexpansiveSection]"},G=function(e,t){var a=e.children(t).detach();e.append(a)};e(document).on("click","#builder-add-row",function(t){t.preventDefault();var a=e(Rexpansive_Builder_Admin_Templates.templates.section.replace(/\bdata.index\b/g,Rexpansive_Builder_Admin_Config.counter));u.append(a),Rexpansive_Builder_Admin_Config.collect[Rexpansive_Builder_Admin_Config.counter]=new Rexpansive_Builder_Admin_Section.Section(a,Rexpansive_Builder_Admin_Config.counter),Rexpansive_Builder_Admin_Config.collect[Rexpansive_Builder_Admin_Config.counter].init(),Rexpansive_Builder_Admin_Config.counter++,L()}),e(document).on("click",".builder-copy-row",function(t){t.preventDefault();var a=e(this).parents(".builder-row"),i=a.clone();i.attr("data-count",Rexpansive_Builder_Admin_Config.counter),i.attr("data-sectionid",""),i.find(".rex-edit-dimension-wrap input[id^=section-full-]").attr("id","section-full-"+Rexpansive_Builder_Admin_Config.counter).attr("name","section-dimension-"+Rexpansive_Builder_Admin_Config.counter),i.find(".rex-edit-dimension-wrap label[for^=section-full-]").attr("for","section-full-"+Rexpansive_Builder_Admin_Config.counter),i.find(".rex-edit-dimension-wrap input[id^=section-boxed-]").attr("id","section-boxed-"+Rexpansive_Builder_Admin_Config.counter).attr("name","section-dimension-"+Rexpansive_Builder_Admin_Config.counter),i.find(".rex-edit-dimension-wrap label[for^=section-boxed-]").attr("for","section-boxed-"+Rexpansive_Builder_Admin_Config.counter),i.find(".rex-edit-layout-wrap input[id^=section-fixed-]").attr("id","section-fixed-"+Rexpansive_Builder_Admin_Config.counter).attr("name","section-layout-"+Rexpansive_Builder_Admin_Config.counter),i.find(".rex-edit-layout-wrap label[for^=section-fixed-]").attr("for","section-fixed-"+Rexpansive_Builder_Admin_Config.counter),i.find(".rex-edit-layout-wrap input[id^=section-masonry-]").attr("id","section-masonry-"+Rexpansive_Builder_Admin_Config.counter).attr("name","section-layout-"+Rexpansive_Builder_Admin_Config.counter),i.find(".rex-edit-layout-wrap label[for^=section-masonry-]").attr("for","section-masonry-"+Rexpansive_Builder_Admin_Config.counter),i.find(".item").each(function(t,a){var i=e(a).attr("id"),o=i.replace(/_(\d+)_/g,"_"+Rexpansive_Builder_Admin_Config.counter+"_");e(a).attr("id",o)}),a.after(i),Rexpansive_Builder_Admin_Config.collect[Rexpansive_Builder_Admin_Config.counter]=new Rexpansive_Builder_Admin_Section.Section(i,Rexpansive_Builder_Admin_Config.counter),Rexpansive_Builder_Admin_Config.collect[Rexpansive_Builder_Admin_Config.counter].init(),Rexpansive_Builder_Admin_Config.counter++,L()}),e(document).on("click",".builder-delete-row",function(t){if(_plugin_backend_settings.activate_builder&&e("#builder-switch").prop("checked")){t.preventDefault(),Rexpansive_Builder_Admin_Config.counter--;for(var a=parseInt(e(this).parents(".builder-row").attr("data-count")),i=-1,o=0,r=Rexpansive_Builder_Admin_Config.collect.length;o<r;o++)if(Rexpansive_Builder_Admin_Config.collect[o].sectIndex===a){i=o;break}Rexpansive_Builder_Admin_Config.collect.splice(i,1),e("#"+e(this).attr("data-tooltip-id")).remove(),e(this).parents(".builder-row").remove(),U()}}),e(document).on("click",".edit_handler",function(t){t.preventDefault();var a=e(this).parents("li"),i=a.parents(".builder-row").attr("data-count"),o='.builder-row[data-count="'+i+'"] #'+a.attr("id");Rexpansive_Builder_Admin_Config.collect[a.parents(".builder-row").attr("data-count")];switch(a.attr("data-block_type")){case"image":Rexpansive_Builder_Admin_TextEditor.openTextEditor(o,a.find(".data-text-content").text());break;case"text":Rexpansive_Builder_Admin_TextEditor.openTextEditor(o,a.find(".data-text-content").text());break;case"expand":var r=a.find(".data-zak-content").attr("data-zak-content");F(o,JSON.parse(r));break;case"video":Rexpansive_Builder_Admin_TextEditor.openTextEditor(o,a.find(".data-text-content").text());break;case"empty":Rexpansive_Builder_Admin_TextEditor.openTextEditor(o,a.find(".data-text-content").text());break;case"rexslider":var l=a.attr("data-block-slider-id");N(o,a.find(".data-text-content").text(),l)}}),e(document).on("click",".builder-add",function(t){if(!e(this).hasClass("builder-show-widgets")){t.preventDefault();var a=e(this).val();Rexpansive_Builder_Admin_Config.collect[e(this).parents(".builder-row").attr("data-count")].addElementOnGrid(a),("post-new-php"==adminpage&&e(this).parents(".builder-buttons-new-row").length>0||"post-php"==adminpage&&e(this).parents(".builder-buttons-new-row").length>0)&&(e(this).parents(".builder-buttons-new-row").hide(),e(this).parents(".builder-new-row").find(".builder-buttons").css("visibility","visible"))}}),e(document).on("click",".copy-handler",function(t){t.preventDefault();var a=e(this).parents("li"),i=a.clone();i.removeClass("gs-w"),i.find(".gs-resize-handle").remove();var o=a.parents(".builder-row").attr("data-count");Rexpansive_Builder_Admin_Config.collect[o].copyElementToGrid(i)}),e(document).on("click",".delete_handler",function(t){t.preventDefault();var a=e(this).parents("li");e("#"+e(this).attr("data-tooltip-id")).remove(),Rexpansive_Builder_Admin_Config.collect[e(this).parents(".builder-row").attr("data-count")].removeElementFromGrid(a),e(document).trigger("rexbuilder:block_deleted",a)}),e("#rexeditor-close").on("click",function(t){t.preventDefault(),e("#editor-save").val(""),Rexpansive_Builder_Admin_Modals.CloseModal(s,!1,["hide-padding-position"]),tinyMCE.triggerSave()}),e("#rexeditor-expand-close").on("click",function(t){t.preventDefault(),e("#expand-editor-save").val(""),Rexpansive_Builder_Admin_Modals.CloseModal(p),tinyMCE.triggerSave()}),e("#expand-editor-cancel").on("click",function(t){t.preventDefault(),e("#expand-editor-save").val(""),Rexpansive_Builder_Admin_Modals.CloseModal(p),tinyMCE.triggerSave()}),e("#expand-editor-save").on("click",function(t){t.preventDefault(),tinyMCE.triggerSave();var a=(tinyMCE.get("rexbuilder_expand_editor"),e("#rexbuilder_expand_editor")),i=e(e(this).val()),o={side:"",background_url:"",background_id:"",title:"",icon_url:"",icon_id:"",content:"",foreground_id:"",foreground_url:""};o.side=e(".exp-side-holder").filter(":checked").val(),"left"==o.side?G(i.find(".element-preview"),".zak-text-side"):"right"==o.side&&G(i.find(".element-preview"),".zak-image-side"),o.background_url=e(".exp-back-holder").val(),o.background_id=e(".exp-back-holder").attr("data-image_id"),o.title=e(".exp-title-holder").val(),o.icon_url=e(".exp-icon-holder").val(),o.icon_id=e(".exp-icon-holder").attr("data-icon_id"),""!==e(".zak-foreground-holder").val()?(o.foreground_id=e(".zak-foreground-holder").attr("data-foreground-id"),o.foreground_url=e(".zak-foreground-holder").val()):(e(".zak-foreground-holder").attr("data-foreground-id",""),e(".zak-foreground-holder").val(""));var r=a.val();o.content=r.replace(/'/gi,"’"),i.find(".data-zak-content").attr("data-zak-content",JSON.stringify(o)),i.find(".zak-text-side").empty().append("<h2>"+o.title+"</h2>"),o.icon_url&&i.find(".zak-text-side").append('<img src="'+o.icon_url+'">'),i.find(".zak-text-side").append('<div class="text-preview">'+a.val().replace(/'/gi,"’")+"</div>"),i.find(".zak-image-side").html('<img src="'+o.background_url+'">'),Rexpansive_Builder_Admin_Modals.CloseModal(p)}),e(".exp-back-upload").on("click",function(t){t.preventDefault(),i(e("input.exp-back-holder"))}),e(".exp-icon-upload").on("click",function(t){t.preventDefault(),o(e("input.exp-icon-holder"))}),e(".zak-foreground-upload").on("click",function(t){t.preventDefault(),r(e("input.zak-foreground-holder"))}),e(document).on("click",".background_handler",function(t){t.preventDefault();var a,i=e(this),o=i.parents(".item").attr("id"),r=i.parents(".builder-row").attr("data-count"),l="";Rexpansive_Builder_Admin_Config.$actual_block_ref=i.parents(".item");var d=Rexpansive_Builder_Admin_Config.$actual_block_ref.attr("data-block-custom-classes");R.isset||(R.isset=!0,R.$modal=e("#background_block_set"),R.$modal_wrap=R.$modal.parent(".rex-modal-wrap"),R.$background_type=e(".background_type"),R.$type_image=e("#background-value-image"),R.$image_preview=e("#bg-img-preview"),R.$image_preview_icon=R.$image_preview.find("i"),R.$image_url=e("#background_url"),R.$image_id=e("#background_up_img"),R.$image_type_wrap=e("#bg-set-img-type"),R.$image_type=e(".background_image_type"),R.$color_preview=e("#background-color-preview"),R.$zoom_wrap=e("#bg-set-photoswipe"),R.$has_zoom=e("#background_photoswipe"),R.$link_wrap=e("#bg-set-link-wrap"),R.$has_link=e("#block_has_link"),R.$link_value=e("#block_link_value"),R.$class_wrap=e("#block-set-class-wrap"),R.$class_value=e("#block_custom_class"),R.$padding_wrap=e("#block-set-padding-wrap"),R.$save_button=e("#background_set_save"),R.$cancel_button=e("#background_set_cancel")),""!==i.parents("#"+o).attr("data-bg_settings")&&(l=JSON.parse(Rexpansive_Builder_Admin_Config.$actual_block_ref.attr("data-bg_settings"))),R.$save_button.attr("data-block_id",o).attr("data-block_parent",r),R.$image_preview_icon.show(),R.$color_value.spectrum("set","transparent"),R.$color_runtime_value.val(""),R.$image_url.val(""),R.$image_id.val(""),R.$color_palette_buttons.removeClass("palette-color-active"),R.$color_preview.css("background-color","transparent"),R.$type_color.prop("checked",!0),R.$color_preview_icon.show(),e(".background_image_type[value=full]").prop("checked",!0),R.$has_zoom.prop("checked",!1),R.$image_preview.css("background-image","none"),"undefined"!=typeof l.color&&""!==l.color?(R.$color_runtime_value.val(l.color),R.$color_value.spectrum("set",l.color),R.$color_preview_icon.hide(),"natural"==l.bg_img_type&&(R.$image_url.val(l.url),R.$image_id.val(l.image),R.$image_preview.css("background-image","url("+l.url+")"),R.$image_preview_icon.hide(),e(".background_image_type[value=natural]").prop("checked",!0)),R.$type_color.prop("checked",!0),R.$color_preview.css("background-color",l.color)):"undefined"!=typeof l.image&&""!==l.image&&(R.$color_value.spectrum("set","transparent"),R.$image_id.val(l.image),R.$image_url.val(l.url),R.$image_preview.css("background-image","url("+l.url+")"),R.$image_preview_icon.hide(),e(".background_type[value=image]").prop("checked",!0),e(".background_image_type[value="+l.bg_img_type+"]").prop("checked",!0),R.$color_preview.css("background-color","transparent")),"undefined"!=typeof l.image_size&&""!==l.image_size&&R.$image_size.val(l.image_size),R.$video_choose.prop("checked",!1),R.$video_mp4_id.val(""),R.$video_youtube_url.val(""),R.$video_youtube_label.removeClass("active"),R.$video_vimeo_url.val(""),R.$video_vimeo_label.removeClass("active"),R.$video_has_audio.prop("checked",!1),"undefined"!=typeof l.video&&""!==l.video&&(R.$video_mp4_id.val(l.video),R.$video_mp4.prop("checked",!0)),"undefined"!=typeof l.youtube&&""!==l.youtube&&(R.$video_youtube.prop("checked",!0),R.$video_youtube_url.val(l.youtube),R.$video_youtube_label.addClass("active")),"undefined"!=typeof l.vimeo&&""!==l.vimeo&&(R.$video_vimeo.prop("checked",!0),R.$video_vimeo_url.val(l.vimeo),R.$video_vimeo_label.addClass("active")),""!==i.parents("#"+o).attr("data-video-has-audio")&&(a=i.parents("#"+o).attr("data-video-has-audio")),"1"==a&&R.$video_has_audio.prop("checked",!0),R.$link_value.val(""),R.$has_link.prop("checked",!1),R.$link_value.next().removeClass("active"),"undefined"!=typeof l.linkurl&&""!==l.linkurl&&(R.$link_value.val(l.linkurl),R.$link_value.next().addClass("active")),"true"==l.photoswipe&&R.$has_zoom.prop("checked",!0),R.$class_value.val("");var n="";if("undefined"!=typeof d)var n=d;R.$positions.prop("checked",!1);var s=n;if("undefined"!=typeof s&&""!=s){var c=s.match(/rex-flex-(top|middle|bottom|left|center|right)/g);if(c&&c.length>0){c[0]=c[0].replace("rex-flex-",""),c[1]=c[1].replace("rex-flex-","");var p="[value=";p+=c[0].search(/(top|middle|bottom)/g)!=-1?c[0]+"-"+c[1]+"]":c[1]+"-"+c[0]+"]",R.$positions.filter(p).prop("checked",!0),n=n.replace(/rex-flex-(top|middle|bottom|left|center|right)\s*/g,"")}else R.$positions.prop("checked",!1)}var _=Rexpansive_Builder_Admin_Config.$actual_block_ref.attr("data-content-padding");if("undefined"!=typeof _&&""!=_){var u=_.split(";");u.length>1?(R.$block_padding_top.val(u[0].replace(/[\D]+/g,"")),R.$block_padding_right.val(u[1].replace(/[\D]+/g,"")),R.$block_padding_bottom.val(u[2].replace(/[\D]+/g,"")),R.$block_padding_left.val(u[3].replace(/[\D]+/g,""))):(R.$block_padding_top.val(u[0].replace(/[\D]+/g,"")),R.$block_padding_right.val(u[0].replace(/[\D]+/g,"")),R.$block_padding_bottom.val(u[0].replace(/[\D]+/g,"")),R.$block_padding_left.val(u[0].replace(/[\D]+/g,"")));var v=u[0].match(/[\D]+/g)[0];switch(v){case"px":R.$block_padding_type_pixel.prop("checked",!0);break;case"%":R.$block_padding_type_percentage.prop("checked",!0)}}else R.$block_padding_top.val("5"),R.$block_padding_right.val("5"),R.$block_padding_bottom.val("5"),R.$block_padding_left.val("5"),R.$block_padding_type_pixel.prop("checked",!0);if(R.$has_overlay_small.prop("checked",!1),R.$has_overlay_medium.prop("checked",!1),R.$has_overlay_large.prop("checked",!1),R.$overlay_color_preview_icon.show(),R.$overlay_color_palette_buttons.removeClass("palette-color-active"),"undefined"!=typeof d&&""!=d){var m=d.match(/active-(large|medium|small)-block-overlay/g);if(m&&m.length>0){for(var g=0;g<m.length;g++){var b=m[g];b=b.match(/active-(large|medium|small)(?=-block-overlay)/g),b=b[0].replace(/active-/g,"");var f="[value="+b+"]";R.$has_overlay_group.filter(f).prop("checked",!0)}n=n.replace(/active-(large|medium|small)-block-overlay\s*/g,"")}}var h=l.overlay_block_color;"undefined"!=typeof h&&""!==h?(R.$overlay_color_value.spectrum("set",h),R.$overlay_color_preview_icon.hide()):R.$overlay_color_value.spectrum("set","rgba(255,255,255,0.5)"),n=n.replace(/rex-flex-(top|middle|bottom|left|center|right)\s*/g,""),R.$class_value.val(n.trim()),""!=n?R.$class_value.next().addClass("active"):R.$class_value.next().removeClass("active"),R.$modal.removeClass("rex-modal-section-background"),Rexpansive_Builder_Admin_Modals.OpenModal(R.$modal_wrap),R.$image_type_wrap.show(),R.$link_wrap.show(),R.$zoom_wrap.show(),R.$class_wrap.show(),R.$padding_wrap.show(),R.$video_has_audio_wrap.show(),Rexpansive_Builder_Admin_Config.$lean_overlay.show()}),e("#background_block_set").on("click","#background_up_img, #background_url, #bg-img-preview",function(){t(e(this))}),e("#background_block_set").on("click","#rex-block-upload-mp4",function(){a(e(this))}),e("#background_set_cancel").on("click",function(){e("#background_set_save").attr("data-block_id",""),e("#background_set_save").attr("data-section_id",""),Rexpansive_Builder_Admin_Modals.CloseModal(R.$modal_wrap)}),e("#background_block_set").on("focus","#block_link_value",function(){e("#block_has_link").prop("checked",!0)}),e(document).on("click",".background_section_preview",function(t){t.preventDefault();var a,i,o,r=e(this).parents(".builder-row");if(R.isset||(R.isset=!0,R.$modal=e("#background_block_set"),R.$modal_wrap=R.$modal.parent(".rex-modal-wrap"),R.$background_type=e(".background_type"),R.$type_image=e("#background-value-image"),R.$image_preview=e("#bg-img-preview"),R.$image_preview_icon=R.$image_preview.find("i"),R.$image_url=e("#background_url"),R.$image_id=e("#background_up_img"),R.$image_type_wrap=e("#bg-set-img-type"),R.$image_type=e(".background_image_type"),R.$color_preview=e("#background-color-preview"),R.$zoom_wrap=e("#bg-set-photoswipe"),R.$has_zoom=e("#background_photoswipe"),R.$link_wrap=e("#bg-set-link-wrap"),R.$has_link=e("#block_has_link"),R.$link_value=e("#block_link_value"),R.$class_wrap=e("#block-set-class-wrap"),R.$class_value=e("#block_custom_class"),R.$padding_wrap=e("#block-set-padding-wrap"),R.$save_button=e("#background_set_save"),R.$cancel_button=e("#background_set_cancel")),""!==r.attr("data-gridproperties")&&(a=JSON.parse(r.attr("data-gridproperties"))),""!==r.attr("data-backresponsive")&&(i=JSON.parse(r.attr("data-backresponsive")),o=i.custom_classes),""!==r.attr("data-section-overlay-color"))var l=r.attr("data-section-overlay-color");if(R.$save_button.attr("data-section_id",r.attr("data-count")),R.$image_preview_icon.show(),R.$color_value.spectrum("set","transparent"),R.$color_runtime_value.val(""),R.$image_url.val(""),R.$image_id.val(""),R.$background_type.prop("checked",!1),R.$color_palette_buttons.removeClass("palette-color-active"),R.$color_preview.css("background-color","transparent"),R.$image_preview.css("background-image","none"),R.$color_preview_icon.show(),"undefined"!=typeof a.color&&""!==a.color?(R.$color_value.spectrum("set",a.color),R.$color_runtime_value.val(a.color),R.$type_color.prop("checked",!0),R.$color_preview.css("background-color",a.color),R.$color_preview_icon.hide()):"undefined"!=typeof a.image&&""!==a.image&&(R.$image_url.val(a.url),R.$image_id.val(a.image),R.$type_image.prop("checked",!0),R.$image_preview.css("background-image","url("+a.url+")"),R.$image_preview_icon.hide()),R.$video_choose.prop("checked",!1),R.$video_mp4_id.val(""),R.$video_youtube_url.val(""),R.$video_youtube_label.removeClass("active"),R.$video_vimeo_url.val(""),R.$video_vimeo_label.removeClass("active"),"undefined"!=typeof a.video&&""!==a.video&&(R.$video_mp4.prop("checked",!0),R.$video_mp4_id.val(a.video)),"undefined"!=typeof a.youtube&&""!==a.youtube&&(R.$video_youtube.prop("checked",!0),R.$video_youtube_url.val(a.youtube),R.$video_youtube_label.addClass("active")),"undefined"!=typeof a.vimeo&&""!==a.vimeo&&(R.$video_vimeo.prop("checked",!0),R.$video_vimeo_url.val(a.vimeo),R.$video_vimeo_label.addClass("active")),R.$has_overlay_small.prop("checked",!1),R.$has_overlay_medium.prop("checked",!1),R.$has_overlay_large.prop("checked",!1),R.$overlay_color_preview_icon.show(),R.$overlay_color_palette_buttons.removeClass("palette-color-active"),"undefined"!=typeof o&&""!=o){var d=o.match(/active-(large|medium|small)-overlay/g);if(d&&d.length>0)for(var n=0;n<d.length;n++){var s=d[n];s=s.match(/active-(large|medium|small)(?=-overlay)/g),s=s[0].replace(/active-/g,"");var c="[value="+s+"]";R.$has_overlay_group.filter(c).prop("checked",!0)}}if("undefined"!=typeof l&&""!==l){R.$overlay_color_value.spectrum("set",l),R.$overlay_color_preview_icon.hide();var p=l.replace("rgba(","").replace(")",""),_=p.split(",");_=_[_.length-1],0!=_&&R.$overlay_color_preview_icon.hide()}R.$modal.addClass("rex-modal-section-background"),Rexpansive_Builder_Admin_Modals.OpenModal(R.$modal_wrap),R.$zoom_wrap.hide(),R.$link_wrap.hide(),R.$class_wrap.hide(),R.$padding_wrap.hide(),R.$image_type_wrap.hide(),R.$video_has_audio_wrap.hide(),Rexpansive_Builder_Admin_Config.$lean_overlay.show()}),e("#background_block_set").on("focus","#background_url, #background_up_img",function(){R.$type_image.prop("checked",!0)}),e("#background_block_set").on("focus","#background-block-color",function(){R.$type_color.prop("checked",!0)}),e("#background_set_save").on("click",function(){var t=e(this).attr("data-block_id"),a=(e(this).attr("data-block_parent"),e(this).attr("data-section_id")),i=e(".background_type:checked").val(),o=e("#"+t).attr("data-block-custom-classes"),r=(e("#"+t).attr("data-video-has-audio"),{color:"",image:"",url:"",bg_img_type:"",photoswipe:"",linkurl:"",block_custom_class:"",block_padding:"",video:"",youtube:"",vimeo:"",overlay_block_color:""}),l=e(".background_image_type:checked").val();switch(i){case"transparent":r.color=r.image=r.url=r.bg_img_type="";break;case"image":r.image=e("#background_up_img").val(),r.url=e("#background_url").val(),r.bg_img_type=e(".background_image_type:checked").val();break;case"color":var d=R.$color_value.spectrum("get");d=d.toRgbString(),r.color=d,r.color=R.$color_runtime_value.val(),"natural"==l&&(r.image=e("#background_up_img").val(),r.url=e("#background_url").val(),r.bg_img_type=e(".background_image_type:checked").val())}var n=e("#"+t).find(".element-visual-info"),s=!1,c=R.$video_choose.filter(":checked").val();if("undefined"!=typeof R.$video_mp4_id.val()&&""!==R.$video_mp4_id.val()&&"mp4"==c&&(r.video=R.$video_mp4_id.val(),s=!0),"undefined"!=typeof R.$video_youtube_url.val()&&""!==R.$video_youtube_url.val()&&"youtube"==c&&(r.youtube=R.$video_youtube_url.val(),s=!0),"undefined"!=typeof R.$video_vimeo_url.val()&&""!==R.$video_vimeo_url.val()&&"vimeo"==c&&(r.vimeo=R.$video_vimeo_url.val(),s=!0),R.$video_has_audio.prop("checked")?e("#"+t).attr("data-video-has-audio","1"):e("#"+t).attr("data-video-has-audio","0"),s?n.addClass("rex-active-video-notice"):n.removeClass("rex-active-video-notice"),a){e(".builder-row[data-count="+a+"]").attr("data-gridproperties",JSON.stringify(r));var p=R.$overlay_color_value.spectrum("get"),_=!0===R.$has_overlay_small.prop("checked")?"true":"",u=!0===R.$has_overlay_medium.prop("checked")?"true":"",v=!0===R.$has_overlay_large.prop("checked")?"true":"",m=e(".builder-row[data-count="+a+"]"),g=JSON.parse(m.attr("data-backresponsive")),b=g.custom_classes.replace(/active-(small|medium|large)-overlay/g,"").trim();switch(i){case"transparent":m.find(".background_section_preview").css("background-image","none"),m.find(".background_section_preview").css("background-color","transparent"),m.find(".gridster > ul").css("background-color","transparent"),m.find(".gridster > ul").css("background-image","none");break;case"image":m.find(".background_section_preview").css("background-image","url("+r.url+")"),m.find(".background_section_preview").css("background-color","transparent"),m.find(".gridster > ul").css("background-image","url("+r.url+")"),m.find(".gridster > ul").css("background-color","transparent");break;case"color":m.find(".background_section_preview").css("background-image","none"),m.find(".background_section_preview").css("background-color",r.color),m.find(".gridster > ul").css("background-color",r.color),m.find(".gridster > ul").css("background-image","none")}var f=!1;"true"==_&&(b+=" active-small-overlay",f=!0),"true"==u&&(b+=" active-medium-overlay",f=!0),"true"==v&&(b+=" active-large-overlay",f=!0);var h={gutter:g.gutter,isFull:g.isFull,custom_classes:b.trim(),section_width:g.section_width};if(f){var k="rgba("+p.toRgbString()+")";m.find(".gridster .section-visual-info").css("background-color",k).addClass("active-section-visual-info")}else m.find(".gridster .section-visual-info").removeClass("active-section-visual-info");m.attr("data-section-overlay-color",p.toRgbString()),m.attr("data-backresponsive",JSON.stringify(h)),Rexpansive_Builder_Admin_Config.grid_appearance_modified=!0,e(document).trigger("rexbuilder:section_bg_edit",m)}else if(t){var $=Rexpansive_Builder_Admin_Config.$actual_block_ref;"undefined"!=typeof R.$link_value.val()&&""!=R.$link_value.val()&&(r.linkurl=e("#block_link_value").val()),1==e("#background_photoswipe").prop("checked")&&(r.photoswipe="true");var w=R.$class_value.val(),x=o.match(/active-(small|medium|large)-block-overlay|rex-flex-(top|middle|bottom|left|center|right)/g);x=x?x.join(" "):"";var y=(w.trim()+" "+x.trim(),R.$positions.filter(":checked").val()),C="",A="",B=w.trim();if("undefined"!=typeof y&&""!==y){A+="element-content-positioned";var S=y.match(/(top|middle|bottom|left|center|right)/g);switch(S[0]){case"top":C+=" rex-flex-top",A+=" element-content-positioned-top";break;case"middle":C+=" rex-flex-middle",A+=" element-content-positioned-middle";break;case"bottom":C+=" rex-flex-bottom",A+=" element-content-positioned-bottom"}switch(S[1]){case"left":C+=" rex-flex-left",A+=" element-content-positioned-left";break;case"center":C+=" rex-flex-center",A+=" element-content-positioned-center";break;case"right":C+=" rex-flex-right",A+=" element-content-positioned-right"}}B=B+" "+C.trim(),$.attr("data-block-custom-classes",B.trim()),$.find(".element-preview-wrap").removeClass("element-content-positioned-top element-content-positioned-middle element-content-positioned-bottom element-content-positioned-left element-content-positioned-center element-content-positioned-right").addClass(A);var M="",z=e(".bm-block-padding-type:checked").val(),D="";switch(z){case"percentage":D="%;";break;case"pixel":
D="px;"}var O=R.$block_padding_top.val(),E=R.$block_padding_right.val(),T=R.$block_padding_bottom.val(),N=R.$block_padding_left.val();M+="undefined"!=typeof O&&""!=O&&O.search(/[\d]+/g)!==-1?O+D:"0"+D,M+="undefined"!=typeof E&&""!=E&&E.search(/[\d]+/g)!==-1?E+D:"0"+D,M+="undefined"!=typeof T&&""!=T&&T.search(/[\d]+/g)!==-1?T+D:"0"+D,M+="undefined"!=typeof N&&""!=N&&N.search(/[\d]+/g)!==-1?N+D:"0"+D,Rexpansive_Builder_Admin_Config.$actual_block_ref.attr("data-content-padding",M);for(var U=R.$has_overlay_group.filter(":checked").map(function(){return this.value}).get(),J="",j=0;j<U.length;j++)switch(U[j]){case"small":J+=" active-small-block-overlay";break;case"medium":J+=" active-medium-block-overlay";break;case"large":J+=" active-large-block-overlay"}var L=$.attr("data-block-custom-classes");L=L.replace(/active-(small|medium|large)-block-overlay\s*/g,"").trim();var I=L+" "+J.trim();$.attr("data-block-custom-classes",I.trim());var F=R.$overlay_color_value.spectrum("get").toRgbString();switch(""!=F&&0!=U.length?(r.overlay_block_color=F,$.find(".element-visual-info").css("background-color",F)):(r.overlay_block_color="",R.$overlay_color_value.spectrum("set","transparent"),$.find(".element-visual-info").css("background-color","transparent")),"undefined"!=typeof R.$image_size.val()&&""!==R.$image_size.val()&&(r.image_size=R.$image_size.val()),$.attr("data-bg_settings",JSON.stringify(r)),i){case"transparent":$.find(".element-preview-wrap").css("background-image",""),$.find(".element-preview-wrap").css("background-color",""),$.removeClass("block-is-natural"),""==$.find(".data-text-content").val()&&$.trigger("blockBecomeEmpty"),$.addClass("with-border").removeClass("no-border");break;case"image":"full"==l?($.find(".element-preview-wrap").css("background-image","url("+r.url+")"),$.find(".element-preview").find("img").remove(),$.removeClass("block-is-natural"),$.addClass("no-border").removeClass("with-border")):"natural"==l&&($.addClass("block-is-natural"),$.find(".element-data textarea").val(""),$.addClass("with-border").removeClass("no-border")),$.trigger("blockReturnsNormal");break;case"color":$.find(".element-preview-wrap").css("background-color",r.color),$.find(".element-preview-wrap").css("background-image",""),$.removeClass("block-is-natural"),"natural"==l&&($.find(".element-preview-wrap").css("background-image","url("+r.url+")"),$.addClass("block-is-natural"),$.find(".element-data textarea").val("")),"rgba(255, 255, 255, 0)"!=r.color&&"rgba(255,255,255,0)"!=r.color&&"transparent"!=r.color&&""!==r.color?$.addClass("no-border").removeClass("with-border"):$.addClass("with-border").removeClass("no-border"),$.trigger("blockReturnsNormal")}"transparent"!=i&&$.hasClass("empty")&&(""!==r.color||""!==r.image?$.find(".element-preview .vert-wrap").addClass("hidden"):$.find(".element-preview .vert-wrap").removeClass("hidden")),$.trigger("blockChangeImage"),e(document).trigger("sectionCollectData",Rexpansive_Builder_Admin_Config.collect[$.parents(".builder-row").attr("data-count")]),e(document).trigger("rexbuilder:block_bg_edit",$)}e(this).attr("data-block_id",""),e(this).attr("data-section_id",""),Rexpansive_Builder_Admin_Modals.CloseModal(R.$modal_wrap)}),e(document).on("click",".builder-edit-sectionid",function(t){t.preventDefault();var a=e(this).parents(".builder-row");e("#sectionid-set-save").attr("data-section_id",a.attr("data-count")),""===a.attr("data-sectionid")?e("#sectionid-container").val(""):e("#sectionid-container").val(a.attr("data-sectionid")),e("#modal-sectionid-set").show()}),e(document).on("click","#sectionid-set-cancel",function(t){t.preventDefault(),e("#modal-sectionid-set").hide()}),e(document).on("click","#sectionid-set-save",function(t){t.preventDefault();var a=e(this).attr("data-section_id");e(".builder-row[data-count="+a+"]").attr("data-sectionid",e("#sectionid-container").val()),e("#modal-sectionid-set").hide()}),e(document).on("click",".builder-section-config",function(t){t.preventDefault();var a,i,o=e(this).parents(".builder-row"),r=o.attr("data-sectionid");B.$color_palette_buttons.removeClass("palette-color-active");var l=o.find('.builder-edit-row-wrap input[type="radio"][name^="section-dimension-"]').filter(":checked").val();switch(""!==o.attr("data-backresponsive")&&(a=JSON.parse(o.attr("data-backresponsive"))),""!==o.attr("data-layout")&&(i=o.attr("data-layout")),""!==r?B.$section_id.val(r):B.$section_id.val(""),B.$section_layout_type.prop("checked",!1),i){case"fixed":B.$section_fixed.prop("checked",!0);break;case"masonry":B.$section_masonry.prop("checked",!0);break;default:B.$section_fixed.prop("checked",!0)}if(B.$has_overlay_small.prop("checked",!1),B.$has_overlay_medium.prop("checked",!1),B.$has_overlay_large.prop("checked",!1),B.$color_preview_icon.show(),B.$color_value.spectrum("set","rgba(255,255,255,0.5)"),a){var d=/active-(small|medium|large)-overlay/g,n=(a.custom_classes.match(d,""),a.custom_classes.replace(d,"")),s=/rex-block-grid/g;if(-1!=a.custom_classes.search(s)?B.$hold_grid.prop("checked",!0):B.$hold_grid.prop("checked",!1),n=n.replace(s,""),"undefined"!=typeof a.gutter?e(".section-set-block-gutter").val(a.gutter):e(".section-set-block-gutter").val("20"),n=n.trim(),"undefined"!=typeof n&&""!=n?(e("#section-set-custom-class").val(n),e("#section-set-custom-class").next().addClass("active")):(e("#section-set-custom-class").val(""),e("#section-set-custom-class").next().removeClass("active")),"undefined"!=typeof a.isFull&&"true"==a.isFull?B.$is_full.prop("checked",!0):B.$is_full.prop("checked",!1),"full"==l)B.$section_boxed_width.val("100"),e(".section-width-type[value=percentage]").prop("checked",!0),B.$section_full.prop("checked",!0);else if("boxed"==l)if("undefined"!=typeof a.section_width&&""!==a.section_width){var c=a.section_width.match(/[\D]+/g)[0],p=a.section_width.replace(/[\D]+/g,"");switch(""===p&&(p=80),B.$section_boxed_width.val(p),B.$section_boxed.prop("checked",!0),c){case"px":e(".section-width-type[value=pixel]").prop("checked",!0);break;case"%":e(".section-width-type[value=percentage]").prop("checked",!0)}}else e(".section-width-type[value=percentage]").prop("checked",!0),B.$section_boxed_width.val("80"),B.$section_boxed.prop("checked",!0)}else e(".backresponsive-opacity-section").val("0"),e(".section-set-block-gutter").val("20"),e("#section-set-custom-class").val(""),e(".section-width-type[value=percentage]").prop("checked",!0),"full"==l?(B.$section_boxed_width.val("100"),B.$section_full.prop("checked",!0)):"boxed"==l&&(B.$section_boxed_width.val("80"),B.$section_boxed.prop("checked",!0)),B.$is_full.prop("checked",!1);"undefined"==typeof o.attr("data-row-separator-top")||""==o.attr("data-row-separator-top")?(B.$row_separator_top.val(""),B.$row_separator_top.attr("placeholder",B.$block_gutter.val())):B.$row_separator_top.val(o.attr("data-row-separator-top")),"undefined"==typeof o.attr("data-row-separator-right")||""==o.attr("data-row-separator-right")?(B.$row_separator_right.val(""),B.$row_separator_right.attr("placeholder",B.$block_gutter.val())):B.$row_separator_right.val(o.attr("data-row-separator-right")),"undefined"==typeof o.attr("data-row-separator-bottom")||""==o.attr("data-row-separator-bottom")?(B.$row_separator_bottom.val(""),B.$row_separator_bottom.attr("placeholder",B.$block_gutter.val())):B.$row_separator_bottom.val(o.attr("data-row-separator-bottom")),"undefined"==typeof o.attr("data-row-separator-left")||""==o.attr("data-row-separator-left")?(B.$row_separator_left.val(""),B.$row_separator_left.attr("placeholder",B.$block_gutter.val())):B.$row_separator_left.val(o.attr("data-row-separator-left")),"undefined"==typeof o.attr("data-row-margin-top")||""==o.attr("data-row-margin-top")?B.$row_margin_top.val(""):B.$row_margin_top.val(o.attr("data-row-margin-top")),"undefined"==typeof o.attr("data-row-margin-right")||""==o.attr("data-row-margin-right")?B.$row_margin_right.val(""):B.$row_margin_right.val(o.attr("data-row-margin-right")),"undefined"==typeof o.attr("data-row-margin-bottom")||""==o.attr("data-row-margin-bottom")?B.$row_margin_bottom.val(""):B.$row_margin_bottom.val(o.attr("data-row-margin-bottom")),"undefined"==typeof o.attr("data-row-margin-left")||""==o.attr("data-row-margin-left")?B.$row_margin_left.val(""):B.$row_margin_left.val(o.attr("data-row-margin-left")),B.section_photoswipe_changed=!1,"undefined"!=typeof o.attr("data-section-active-photoswipe")&&"1"==o.attr("data-section-active-photoswipe")?B.$section_active_photoswipe.prop("checked",!0):B.$section_active_photoswipe.prop("checked",!1),e("#backresponsive-set-save").attr("data-section_id",o.attr("data-count")),e("#backresponsive-set-reset").attr("data-section_id",o.attr("data-count")),Rexpansive_Builder_Admin_Modals.OpenModal(e("#modal-background-responsive-set").parent(".rex-modal-wrap"))}),e(document).on("click","#backresponsive-set-cancel",function(t){t.preventDefault(),Rexpansive_Builder_Admin_Modals.CloseModal(e("#modal-background-responsive-set").parent(".rex-modal-wrap"))}),e(document).on("click","#backresponsive-set-reset",function(t){t.preventDefault();var a=e(this).attr("data-section_id");e(".builder-row[data-count="+a+"]").attr("data-backresponsive",""),Rexpansive_Builder_Admin_Modals.CloseModal(e("#modal-background-responsive-set").parent(".rex-modal-wrap"))}),e(document).on("click","#backresponsive-set-save",function(t){t.preventDefault();var a=e(this).attr("data-section_id"),i=(e(".backresponsive-color-section").spectrum("get"),e(".backresponsive-opacity-section").val(),e(".section-set-block-gutter").val()),o=e("#section-set-custom-class").val(),r="",l=!0===B.$section_full.prop("checked")?"true":"false",d=!0===B.$section_boxed.prop("checked")?"true":"false",n=!0===B.$is_full.prop("checked")?"true":"",s=!0===B.$hold_grid.prop("checked")?"true":"false",c=B.$section_id.val(),p=B.$section_layout_type.filter(":checked").val(),_=e(".builder-row[data-count="+a+"]");_.attr("data-layout",p);var u=_.attr("data-backresponsive"),v="";"undefined"!=typeof u&&""!==u&&(u=JSON.parse(u),v=u.custom_classes);var m=_.find('.builder-edit-row-wrap input[type="radio"][name^="section-dimension-"]'),g=m.filter("[id^=section-full]"),b=m.filter("[id^=section-boxed]");_.attr("data-sectionid",c),_.attr("data-row-separator-top",B.$row_separator_top.val()),_.attr("data-row-separator-right",B.$row_separator_right.val()),_.attr("data-row-separator-bottom",B.$row_separator_bottom.val()),_.attr("data-row-separator-left",B.$row_separator_left.val()),_.attr("data-row-margin-top",B.$row_margin_top.val()),_.attr("data-row-margin-right",B.$row_margin_right.val()),_.attr("data-row-margin-bottom",B.$row_margin_bottom.val()),_.attr("data-row-margin-left",B.$row_margin_left.val()),B.section_photoswipe_changed&&(B.$section_active_photoswipe.prop("checked")?(_.attr("data-section-active-photoswipe","1"),H(_,"photoswipe","true")):(_.attr("data-section-active-photoswipe","0"),H(_,"photoswipe","")));var f=v.match(/active-(large|medium|small)-overlay/g);f=f?f.join(" "):"";var h="";"true"==s&&(h="rex-block-grid"),"true"==l?(g.prop("checked",!0),b.prop("checked",!1),_.attr("data-griddimension","full")):"true"==d&&(g.prop("checked",!1),b.prop("checked",!0),_.attr("data-griddimension","boxed")),r=B.$section_boxed_width.val();var k=e(".section-width-type:checked").val();switch(k){case"percentage":"100"==r&&(r=""),r+="%";break;case"pixel":r+="px"}var $=o.trim()+" "+f.trim()+" "+h,w={gutter:i,isFull:n,custom_classes:$.trim(),section_width:r};_.attr("data-backresponsive",JSON.stringify(w)),J(),Rexpansive_Builder_Admin_Modals.CloseModal(e("#modal-background-responsive-set").parent(".rex-modal-wrap")),Rexpansive_Builder_Admin_Config.grid_appearance_modified=!0,Rexpansive_Builder_Admin_Utilities.set_all_posts_modified(Rexpansive_Builder_Admin_Config.post_modified)}),e(document).on("change",".builder-edit-row-dimension",function(){var t=e(this).val();e(this).parents(".builder-row").attr("data-griddimension",t),Rexpansive_Builder_Admin_Config.grid_appearance_modified=!0}),e(document).on("blockBecomeEmpty","li.item",function(){var t='<div class="vert-wrap" style="background-color:#ddd;"><div class="vert-elem"><span class="empty-label">SPACE</span></div></div>';e(this).find(".backend-image-preview").hide(),0===e(this).find(".element-preview .vert-wrap").length?e(this).find(".element-preview").append(t):e(this).find(".element-preview .vert-wrap").show()}),e(document).on("blockReturnsNormal","li.item",function(){e(this).find(".backend-image-preview").show(),e(this).find(".element-preview .vert-wrap").hide()}),e(document).on("blockChangeImage","li.item",function(){var t=JSON.parse(e(this).attr("data-bg_settings"));"natural"==t.bg_img_type?e(this).addClass("block-is-natural").find(".edit_handler"):e(this).removeClass("block-is-natural").find(".edit_handler")});var q=function(e,t){return e!=t},H=function(t,a,i){t.find(".gridster > ul > li").each(function(t,a){var o=e(a).attr("data-bg_settings");if("undefined"!=typeof o&&""!=o&&""!=o.image){var r=JSON.parse(o);r.photoswipe=i,e(a).attr("data-bg_settings",JSON.stringify(r))}})};e("#post").on("submit",function(t){var a;if(_plugin_backend_settings.activate_builder&&e("#builder-switch").prop("checked")){for(a=0;a<Rexpansive_Builder_Admin_Config.collect.length;a++)Rexpansive_Builder_Admin_Config.collect[a].fillEmptyCells(),Rexpansive_Builder_Admin_Config.collect[a].collectGridData();U();for(var i=Rexpansive_Builder_Admin_Hooks.get_save_actions(),a=0;a<i.length;a++)i[a].action();return!0}}),e(document).on("rexbuilder:save_content",function(t){var a;if(_plugin_backend_settings.activate_builder&&e("#builder-switch").prop("checked")){for(a=0;a<Rexpansive_Builder_Admin_Config.collect.length;a++)Rexpansive_Builder_Admin_Config.collect[a].fillEmptyCells(),Rexpansive_Builder_Admin_Config.collect[a].collectGridData();for(var i=(U(),Rexpansive_Builder_Admin_Hooks.get_save_actions()),a=0;a<i.length;a++)i[a].action()}}),v.on("change",function(){for(var e=Rexpansive_Builder_Admin_Hooks.get_switch_actions(),t=0;t<e.length;t++)e[t].action()}),e(document).on("rexbuilder:change_page_template",function(){for(var e=Rexpansive_Builder_Admin_Hooks.get_switch_actions(),t=0;t<e.length;t++)e[t].action()});var V=e("#icl_cfo"),Q=!1;V.length>0&&(V.on("click",function(){Q=!0}),e(document).ajaxSuccess(function(t,a,i){if(icl_ajx_url!=i.url);else if(Q){Q=!1,e("#rexbuilder").find("#builder-area").empty(),e("#rexbuilder").find("#builder-area").append('<tr id="loading-builder"><td>LOADING...<img src="'+icl_ajxloaderimg_src+'"</td></tr>');e(this).val();e.ajax({url:rexajax.ajaxurl,type:"post",data:{action:"live_refresh_builder",post_id:e("#icl_set_duplicate").attr("data-wpml_original_post_id"),rexnonce:rexajax.rexnonce},success:function(t){e("#loading-builder").remove(),e("#rexbuilder").find("#builder-area").html(t),Rexpansive_Builder_Admin_Config.collect=[],Rexpansive_Builder_Admin_Config.counter=0,e(".builder-row").each(function(t,a){Rexpansive_Builder_Admin_Config.collect[t]=new Rexpansive_Builder_Admin_Section.Section(e(a),t),Rexpansive_Builder_Admin_Config.collect[t].init(),Rexpansive_Builder_Admin_Config.counter++}),u.sortable("refresh")}})}else;}))};e(function(){}),e(window).load(function(){t()})}(jQuery);