From e2395e1dcc5faf4abb60e0ce8140459bb3841a58 Mon Sep 17 00:00:00 2001 From: Kristofer Raske Date: Thu, 9 Mar 2017 15:11:59 -0600 Subject: [PATCH 1/8] Including jQueryUI library with only tabs and accordions --- assets/js/dist/vendor/jquery-ui.min.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 assets/js/dist/vendor/jquery-ui.min.js diff --git a/assets/js/dist/vendor/jquery-ui.min.js b/assets/js/dist/vendor/jquery-ui.min.js new file mode 100644 index 0000000..2a1d16f --- /dev/null +++ b/assets/js/dist/vendor/jquery-ui.min.js @@ -0,0 +1,7 @@ +/*! jQuery UI - v1.12.1 - 2017-03-09 +* http://jqueryui.com +* Includes: widget.js, position.js, data.js, disable-selection.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/tabs.js +* Copyright jQuery Foundation and other contributors; Licensed MIT */ + +(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function e(t){for(var e=t.css("visibility");"inherit"===e;)t=t.parent(),e=t.css("visibility");return"hidden"!==e}t.ui=t.ui||{},t.ui.version="1.12.1";var i=0,s=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},l=e.split(".")[0];e=e.split(".")[1];var h=l+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][h.toLowerCase()]=function(e){return!!t.data(e,h)},t[l]=t[l]||{},n=t[l][e],o=t[l][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:l,widgetName:e,widgetFullName:h}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var i,n,o=s.call(arguments,1),a=0,r=o.length;r>a;a++)for(i in o[a])n=o[a][i],o[a].hasOwnProperty(i)&&void 0!==n&&(e[i]=t.isPlainObject(n)?t.isPlainObject(e[i])?t.widget.extend({},e[i],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,i){var n=i.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=s.call(arguments,1),l=this;return a?this.length||"instance"!==o?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(l=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):l=void 0:(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new i(o,this))})),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.on(h,c,r):i.on(h,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,l=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("
"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.widthi?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};h>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),l.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,l=n-r,h=r+e.collisionWidth-a-n;e.collisionWidth>a?l>0&&0>=h?(i=t.left+l+e.collisionWidth-a-n,t.left+=l-i):t.left=h>0&&0>=l?n:l>h?n+a-e.collisionWidth:n:l>0?t.left+=l:h>0?t.left-=h:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,l=n-r,h=r+e.collisionHeight-a-n;e.collisionHeight>a?l>0&&0>=h?(i=t.top+l+e.collisionHeight-a-n,t.top+=l-i):t.top=h>0&&0>=l?n:l>h?n+a-e.collisionHeight:n:l>0?t.top+=l:h>0?t.top-=h:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,l=n.isWindow?n.scrollLeft:n.offset.left,h=t.left-e.collisionPosition.marginLeft,c=h-l,u=h+e.collisionWidth-r-l,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-l,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,l=n.isWindow?n.scrollTop:n.offset.top,h=t.top-e.collisionPosition.marginTop,c=h-l,u=h+e.collisionHeight-r-l,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-l,(i>0||u>a(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}}),t.ui.focusable=function(i,s){var n,o,a,r,l,h=i.nodeName.toLowerCase();return"area"===h?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(h)?(r=!i.disabled,r&&(l=t(i).closest("fieldset")[0],l&&(r=!l.disabled))):r="a"===h?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.widget("ui.accordion",{version:"1.12.1",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:"> li > :first-child, > :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var e=this.options;this.prevShow=this.prevHide=t(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),e.collapsible||e.active!==!1&&null!=e.active||(e.active=0),this._processPanels(),0>e.active&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():t()}},_createIcons:function(){var e,i,s=this.options.icons;s&&(e=t(""),this._addClass(e,"ui-accordion-header-icon","ui-icon "+s.header),e.prependTo(this.headers),i=this.active.children(".ui-accordion-header-icon"),this._removeClass(i,s.header)._addClass(i,null,s.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||this.options.active!==!1||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons()),void 0)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var i=t.ui.keyCode,s=this.headers.length,n=this.headers.index(e.target),o=!1;switch(e.keyCode){case i.RIGHT:case i.DOWN:o=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:o=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(e);break;case i.HOME:o=this.headers[0];break;case i.END:o=this.headers[s-1]}o&&(t(e.target).attr("tabIndex",-1),t(o).attr("tabIndex",0),t(o).trigger("focus"),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===t.ui.keyCode.UP&&e.ctrlKey&&t(e.currentTarget).prev().trigger("focus")},refresh:function(){var e=this.options;this._processPanels(),e.active===!1&&e.collapsible===!0||!this.headers.length?(e.active=!1,this.active=t()):e.active===!1?this._activate(0):this.active.length&&!t.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=t()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var e,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var e=t(this),i=e.uniqueId().attr("id"),s=e.next(),n=s.uniqueId().attr("id");e.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(e=n.height(),this.element.siblings(":visible").each(function(){var i=t(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(e-=i.outerHeight(!0))}),this.headers.each(function(){e-=t(this).outerHeight(!0)}),this.headers.next().each(function(){t(this).height(Math.max(0,e-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===s&&(e=0,this.headers.next().each(function(){var i=t(this).is(":visible");i||t(this).show(),e=Math.max(e,t(this).css("height","").height()),i||t(this).hide()}).height(e))},_activate:function(e){var i=this._findActive(e)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):t()},_setupEvents:function(e){var i={keydown:"_keydown"};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var i,s,n=this.options,o=this.active,a=t(e.currentTarget),r=a[0]===o[0],l=r&&n.collapsible,h=l?t():a.next(),c=o.next(),u={oldHeader:o,oldPanel:c,newHeader:l?t():a,newPanel:h};e.preventDefault(),r&&!n.collapsible||this._trigger("beforeActivate",e,u)===!1||(n.active=l?!1:this.headers.index(a),this.active=r?t():a,this._toggle(u),this._removeClass(o,"ui-accordion-header-active","ui-state-active"),n.icons&&(i=o.children(".ui-accordion-header-icon"),this._removeClass(i,null,n.icons.activeHeader)._addClass(i,null,n.icons.header)),r||(this._removeClass(a,"ui-accordion-header-collapsed")._addClass(a,"ui-accordion-header-active","ui-state-active"),n.icons&&(s=a.children(".ui-accordion-header-icon"),this._removeClass(s,null,n.icons.header)._addClass(s,null,n.icons.activeHeader)),this._addClass(a.next(),"ui-accordion-content-active")))},_toggle:function(e){var i=e.newPanel,s=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,e):(s.hide(),i.show(),this._toggleComplete(e)),s.attr({"aria-hidden":"true"}),s.prev().attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===parseInt(t(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,e,i){var s,n,o,a=this,r=0,l=t.css("box-sizing"),h=t.length&&(!e.length||t.index()1&&i===s}}(),_create:function(){var e=this,i=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,i.collapsible),this._processTabs(),i.active=this._initialActive(),t.isArray(i.disabled)&&(i.disabled=t.unique(i.disabled.concat(t.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):t(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var e=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===e&&(s&&this.tabs.each(function(i,n){return t(n).attr("aria-controls")===s?(e=i,!1):void 0}),null===e&&(e=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===e||-1===e)&&(e=this.tabs.length?0:!1)),e!==!1&&(e=this.tabs.index(this.tabs.eq(e)),-1===e&&(e=i?!1:0)),!i&&e===!1&&this.anchors.length&&(e=0),e},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):t()}},_tabKeydown:function(e){var i=t(t.ui.safeActiveElement(this.document[0])).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(e)){switch(e.keyCode){case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:s++;break;case t.ui.keyCode.UP:case t.ui.keyCode.LEFT:n=!1,s--;break;case t.ui.keyCode.END:s=this.anchors.length-1;break;case t.ui.keyCode.HOME:s=0;break;case t.ui.keyCode.SPACE:return e.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case t.ui.keyCode.ENTER:return e.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}e.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),e.ctrlKey||e.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(e){this._handlePageNav(e)||e.ctrlKey&&e.keyCode===t.ui.keyCode.UP&&(e.preventDefault(),this.active.trigger("focus"))},_handlePageNav:function(e){return e.altKey&&e.keyCode===t.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):e.altKey&&e.keyCode===t.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(e,i){function s(){return e>n&&(e=0),0>e&&(e=n),e}for(var n=this.tabs.length-1;-1!==t.inArray(s(),this.options.disabled);)e=i?e+1:e-1;return e},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).trigger("focus"),t},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):(this._super(t,e),"collapsible"===t&&(this._toggleClass("ui-tabs-collapsible",null,e),e||this.options.active!==!1||this._activate(0)),"event"===t&&this._setupEvents(e),"heightStyle"===t&&this._setupHeightStyle(e),void 0)},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var e=this.options,i=this.tablist.children(":has(a[href])");e.disabled=t.map(i.filter(".ui-state-disabled"),function(t){return i.index(t)}),this._processTabs(),e.active!==!1&&this.anchors.length?this.active.length&&!t.contains(this.tablist[0],this.active[0])?this.tabs.length===e.disabled.length?(e.active=!1,this.active=t()):this._activate(this._findNextTab(Math.max(0,e.active-1),!1)):e.active=this.tabs.index(this.active):(e.active=!1,this.active=t()),this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var e=this,i=this.tabs,s=this.anchors,n=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,"> li",function(e){t(this).is(".ui-state-disabled")&&e.preventDefault()}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){t(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return t("a",this)[0]}).attr({role:"presentation",tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=t(),this.anchors.each(function(i,s){var n,o,a,r=t(s).uniqueId().attr("id"),l=t(s).closest("li"),h=l.attr("aria-controls");e._isLocal(s)?(n=s.hash,a=n.substring(1),o=e.element.find(e._sanitizeSelector(n))):(a=l.attr("aria-controls")||t({}).uniqueId()[0].id,n="#"+a,o=e.element.find(n),o.length||(o=e._createPanel(a),o.insertAfter(e.panels[i-1]||e.tablist)),o.attr("aria-live","polite")),o.length&&(e.panels=e.panels.add(o)),h&&l.data("ui-tabs-aria-controls",h),l.attr({"aria-controls":a,"aria-labelledby":r}),o.attr("aria-labelledby",r) +}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(e){return t("
").attr("id",e).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(e){var i,s,n;for(t.isArray(e)&&(e.length?e.length===this.anchors.length&&(e=!0):e=!1),n=0;s=this.tabs[n];n++)i=t(s),e===!0||-1!==t.inArray(n,e)?(i.attr("aria-disabled","true"),this._addClass(i,null,"ui-state-disabled")):(i.removeAttr("aria-disabled"),this._removeClass(i,null,"ui-state-disabled"));this.options.disabled=e,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,e===!0)},_setupEvents:function(e){var i={};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(e){var i,s=this.element.parent();"fill"===e?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=t(this).outerHeight(!0)}),this.panels.each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.panels.each(function(){i=Math.max(i,t(this).height("").height())}).height(i))},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),o=n.closest("li"),a=o[0]===s[0],r=a&&i.collapsible,l=r?t():this._getPanelForTab(o),h=s.length?this._getPanelForTab(s):t(),c={oldTab:s,oldPanel:h,newTab:r?t():o,newPanel:l};e.preventDefault(),o.hasClass("ui-state-disabled")||o.hasClass("ui-tabs-loading")||this.running||a&&!i.collapsible||this._trigger("beforeActivate",e,c)===!1||(i.active=r?!1:this.tabs.index(o),this.active=a?t():o,this.xhr&&this.xhr.abort(),h.length||l.length||t.error("jQuery UI Tabs: Mismatching fragment identifier."),l.length&&this.load(this.tabs.index(o),e),this._toggle(e,c))},_toggle:function(e,i){function s(){o.running=!1,o._trigger("activate",e,i)}function n(){o._addClass(i.newTab.closest("li"),"ui-tabs-active","ui-state-active"),a.length&&o.options.show?o._show(a,o.options.show,s):(a.show(),s())}var o=this,a=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){o._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),n()}):(this._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),a.length&&r.length?i.oldTab.attr("tabIndex",-1):a.length&&this.tabs.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),a.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(e){var i,s=this._findActive(e);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return e===!1?t():this.tabs.eq(e)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+t.ui.escapeSelector(e)+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){t.data(this,"ui-tabs-destroy")?t(this).remove():t(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}),this.tabs.each(function(){var e=t(this),i=e.data("ui-tabs-aria-controls");i?e.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):e.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(e){var i=this.options.disabled;i!==!1&&(void 0===e?i=!1:(e=this._getIndex(e),i=t.isArray(i)?t.map(i,function(t){return t!==e?t:null}):t.map(this.tabs,function(t,i){return i!==e?i:null})),this._setOptionDisabled(i))},disable:function(e){var i=this.options.disabled;if(i!==!0){if(void 0===e)i=!0;else{if(e=this._getIndex(e),-1!==t.inArray(e,i))return;i=t.isArray(i)?t.merge([e],i).sort():[e]}this._setOptionDisabled(i)}},load:function(e,i){e=this._getIndex(e);var s=this,n=this.tabs.eq(e),o=n.find(".ui-tabs-anchor"),a=this._getPanelForTab(n),r={tab:n,panel:a},l=function(t,e){"abort"===e&&s.panels.stop(!1,!0),s._removeClass(n,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===s.xhr&&delete s.xhr};this._isLocal(o[0])||(this.xhr=t.ajax(this._ajaxSettings(o,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(this._addClass(n,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done(function(t,e,n){setTimeout(function(){a.html(t),s._trigger("load",i,r),l(n,e)},1)}).fail(function(t,e){setTimeout(function(){l(t,e)},1)})))},_ajaxSettings:function(e,i,s){var n=this;return{url:e.attr("href").replace(/#.*$/,""),beforeSend:function(e,o){return n._trigger("beforeLoad",i,t.extend({jqXHR:e,ajaxSettings:o},s))}}},_getPanelForTab:function(e){var i=t(e).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),t.uiBackCompat!==!1&&t.widget("ui.tabs",t.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}}),t.ui.tabs}); \ No newline at end of file From 2e568976841d8cfd9d79b3396756b2fb6ac07bc4 Mon Sep 17 00:00:00 2001 From: Kristofer Raske Date: Thu, 9 Mar 2017 15:48:47 -0600 Subject: [PATCH 2/8] Oh yeah, jquery-ui is built into wordpress. Okay. Let's try it --- assets/js/dist/admin.min.js | 2 +- assets/js/dist/canvas.js | 188 ++++++++++-------- assets/js/dist/canvas.min.js | 11 +- assets/js/dist/frontend.js | 183 +++++++++-------- assets/js/dist/frontend.min.js | 2 +- assets/js/dist/sidebar.min.js | 6 +- assets/js/dist/tinymce.min.js | 2 +- assets/js/dist/vendor/jquery-ui.min.js | 7 - assets/js/src/shared/components/ui/toggles.js | 180 +++++++++-------- tailor.php | 14 +- 10 files changed, 304 insertions(+), 291 deletions(-) delete mode 100644 assets/js/dist/vendor/jquery-ui.min.js diff --git a/assets/js/dist/admin.min.js b/assets/js/dist/admin.min.js index d744f81..9421dc6 100644 --- a/assets/js/dist/admin.min.js +++ b/assets/js/dist/admin.min.js @@ -1 +1 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 0 && this.$toggles.length > initial ) { - this.activate( this.$toggles[ initial ] ); - } - }, - - /** - * Caches the toggles and toggle content. - * - * @since 1.0.0 - */ - querySelectors : function() { - this.$content = this.$el.find( this.options.content ).hide(); - this.$toggles = this.$el - .find( this.options.toggles ) - .off() - .on( 'click', $.proxy( this.onClick, this ) ); - }, - - /** - * Activates a given toggle. - * - * @since 1.0.0 - * - * @param el - */ - activate: function( el ) { - var speed = this.options.speed; - var $el = $( el ); - - if ( this.options.accordion ) { - this.$toggles.filter( function() { - return this !== el; - } ).removeClass( 'is-active' ); - - this.$content.each( function() { - var $toggle = $( this ); - if ( el.nextElementSibling == this ) { - $toggle.slideToggle( speed ); - } - else { - $toggle.slideUp( speed ); - } - } ); - } - else { - this.$content - .filter( function() { return el.nextElementSibling == this; } ) - .slideToggle( speed ); - } - - $el.toggleClass( 'is-active' ); - - $win.trigger( 'resize' ); - }, - - /** - * Activates a toggle when it is clicked. - * - * @since 1.7.5 - * - * @param e - */ - onClick: function( e ) { - this.activate( e.target ); - e.preventDefault(); - }, + initialize : function() { + this.$el.tabs(); + } - /** - * Element listeners - */ - onDestroy: function( e ) { - this.$toggles.off(); - }, + // /** + // * Initializes the component. + // * + // * @since 1.7.5 + // */ + // onInitialize : function() { + // this.querySelectors(); + // + // var initial = this.options.initial - 1; + // if ( initial >= 0 && this.$toggles.length > initial ) { + // this.activate( this.$toggles[ initial ] ); + // } + // }, + // + // /** + // * Caches the toggles and toggle content. + // * + // * @since 1.0.0 + // */ + // querySelectors : function() { + // this.$content = this.$el.find( this.options.content ).hide(); + // this.$toggles = this.$el + // .find( this.options.toggles ) + // .off() + // .on( 'click', $.proxy( this.onClick, this ) ); + // }, + // + // /** + // * Activates a given toggle. + // * + // * @since 1.0.0 + // * + // * @param el + // */ + // activate: function( el ) { + // var speed = this.options.speed; + // var $el = $( el ); + // + // if ( this.options.accordion ) { + // this.$toggles.filter( function() { + // return this !== el; + // } ).removeClass( 'is-active' ); + // + // this.$content.each( function() { + // var $toggle = $( this ); + // if ( el.nextElementSibling == this ) { + // $toggle.slideToggle( speed ); + // } + // else { + // $toggle.slideUp( speed ); + // } + // } ); + // } + // else { + // this.$content + // .filter( function() { return el.nextElementSibling == this; } ) + // .slideToggle( speed ); + // } + // + // $el.toggleClass( 'is-active' ); + // + // $win.trigger( 'resize' ); + // }, + // + // /** + // * Activates a toggle when it is clicked. + // * + // * @since 1.7.5 + // * + // * @param e + // */ + // onClick: function( e ) { + // this.activate( e.target ); + // e.preventDefault(); + // }, + // + // /** + // * Element listeners + // */ + // onDestroy: function( e ) { + // this.$toggles.off(); + // }, + // + // /** + // * Child listeners + // */ + // onChangeChild: function() { + // this.querySelectors(); + // } - /** - * Child listeners - */ - onChangeChild: function() { - this.querySelectors(); - } - } ); /** diff --git a/assets/js/dist/canvas.min.js b/assets/js/dist/canvas.min.js index 14302b4..aa158af 100644 --- a/assets/js/dist/canvas.min.js +++ b/assets/js/dist/canvas.min.js @@ -1,8 +1,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o'+'
'+"
")},onResize:function(e){var columnView=this;var device=app.channel.request("sidebar:device");var setting="desktop"==device?"width":"width_"+device;var model=columnView.model;var nextModel=model.collection.findWhere({parent:model.get("parent"),order:model.get("order")+1});var atts=model.get("atts");var nextAtts=nextModel.get("atts");var width=parseFloat(atts[setting]||atts.width);var nextWidth=parseFloat(nextAtts[setting]||nextAtts.width);var columnsWidth=width+nextWidth;var column=columnView.el.getBoundingClientRect();var $first=$(''+width+"%");var $second=$(''+nextWidth+"%");$first.prependTo(columnView.$el);$second.prependTo(columnView.$el.next());function onResize(e){document.body.classList.add("is-resizing");document.body.style.cursor="col-resize";var columnWidth=Math.min(columnsWidth-10,Math.max(10,Math.round(parseFloat((e.clientX-column.left)/column.width*width)*10)/10));var nextColumnWidth=Math.round(parseFloat(columnsWidth-columnWidth)*10)/10;columnWidth+="%";nextColumnWidth+="%";$first.html(columnWidth);$second.html(nextColumnWidth);var atts=_.clone(model.get("atts"));var nextAtts=_.clone(nextModel.get("atts"));atts[setting]=columnWidth;nextAtts[setting]=nextColumnWidth;model.set("atts",atts,{silent:true});nextModel.set("atts",nextAtts,{silent:true});model.trigger("change:width",model,atts);nextModel.trigger("change:width",nextModel,nextAtts)}function onResizeEnd(){document.removeEventListener("mousemove",onResize,false);document.removeEventListener("mouseup",onResizeEnd,false);document.body.classList.remove("is-resizing");document.body.style.cursor="default";$first.remove();$second.remove();var atts=model.get("atts");if(width!=atts[setting]){app.channel.trigger("element:resize",model)}}document.addEventListener("mousemove",onResize,false);document.addEventListener("mouseup",onResizeEnd,false);app.channel.trigger("canvas:reset");return false},onChangeWidth:function(model,atts){this.updateCSS(model.get("id"),atts);this.triggerAll("element:refresh",this)},updateCSS:function(elementId,atts){var ruleSet={};var width=atts["width"];var tabletWidth=atts["width_tablet"]||atts["width"];var mobileWidth=atts["width_mobile"]||atts["width"];ruleSet["desktop"]={};ruleSet["desktop"][elementId]=[{selectors:[],declarations:{width:width},setting:"width"}];ruleSet["tablet"]={};ruleSet["tablet"][elementId]=[{selectors:[".mobile-columns &",".tablet-columns &"],declarations:{width:tabletWidth},setting:"width_tablet"}];ruleSet["mobile"]={};ruleSet["mobile"][elementId]=[{selectors:[".mobile-columns &"],declarations:{width:mobileWidth},setting:"width_mobile"}];cssModule.deleteRules(elementId,"width");cssModule.deleteRules(elementId,"width_tablet");cssModule.deleteRules(elementId,"width_mobile");cssModule.addRules(ruleSet)}});module.exports=ColumnView},{"./../element-container":17}],10:[function(require,module,exports){var ContainerView=require("./../element-container"),TabView;TabView=ContainerView.extend({onRenderTemplate:function(){this.el.draggable=false;this.el.id=this.model.cid}});module.exports=TabView},{"./../element-container":17}],11:[function(require,module,exports){var ContainerView=require("./../element-container"),CarouselNavigationView=require("./navigation/carousel-navigation"),CarouselView;CarouselView=ContainerView.extend({onBeforeRenderTemplate:function(){if(this.navigation){this.navigation.triggerMethod("destroy")}},onRenderTemplate:function(){this.navigation=new CarouselNavigationView({model:this.model,collection:this.collection,sort:false});this.$el.append(this.navigation.render().el)},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this);this.navigation.triggerMethod("destroy")}});module.exports=CarouselView},{"./../element-container":17,"./navigation/carousel-navigation":13}],12:[function(require,module,exports){module.exports=Marionette.ItemView.extend({tagName:"li",attributes:function(){return{"data-id":this.model.cid}},getTemplate:function(){return _.template('')}})},{}],13:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({tagName:"ul",className:"slick-dots",childView:require("./carousel-navigation-item"),events:{dragstart:"onDragStart"},onDragStart:function(e){app.channel.trigger("canvas:reset");e.stopPropagation()},onRender:function(){var view=this;this.sortable=new Sortable(view.el,{draggable:"li",animation:150,onUpdate:function(e){var cid=e.item.getAttribute("data-id");view.$el.trigger("before:navigation:reorder",[cid,e.newIndex,e.oldIndex]);view.$el.trigger("navigation:reorder",[cid,e.newIndex,e.oldIndex]);app.channel.trigger("navigation:reorder",view.model)}})},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return child.get("parent")===this.model.get("id")},onBeforeDestroy:function(){this.sortable.destroy()}})},{"./carousel-navigation-item":12}],14:[function(require,module,exports){module.exports=Marionette.ItemView.extend({tagName:"li",className:function(){return"tailor-tabs__navigation-item tailor-"+this.model.get("id")},modelEvents:{"change:atts":"onChangeAttributes"},attributes:function(){return{"data-id":this.model.cid}},getTemplate:function(){return _.template('<%= title || "Tab" %>')},serializeData:function(){var data=Marionette.ItemView.prototype.serializeData.apply(this,arguments);var atts=this.model.get("atts");data.title=atts.title;return data},onChangeAttributes:function(model,atts){this.el.innerHTML=atts.title||"Tab"}})},{}],15:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({childView:require("./tabs-navigation-item"),events:{dragstart:"onDragStart"},onDragStart:function(e){app.channel.trigger("canvas:reset");e.stopPropagation()},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return child.get("parent")===this.model.get("id")},onRender:function(){var view=this;this.sortable=new Sortable(view.el,{draggable:"li",animation:150,onUpdate:function(e){var cid=e.item.getAttribute("data-id");view.$el.trigger("before:navigation:reorder",[cid,e.newIndex,e.oldIndex]);view.$el.trigger("navigation:reorder",[cid,e.newIndex,e.oldIndex]);app.channel.trigger("navigation:reorder",view.model)}})},onBeforeDestroy:function(){this.sortable.destroy()}})},{"./tabs-navigation-item":14}],16:[function(require,module,exports){var ContainerView=require("./../element-container"),TabsNavigationView=require("./navigation/tabs-navigation"),TabsView;TabsView=ContainerView.extend({ui:{navigation:".tailor-tabs__navigation"},onBeforeRenderTemplate:function(){if(this.navigation){this.navigation.triggerMethod("destroy")}},onRenderTemplate:function(){this.navigation=new TabsNavigationView({el:this.ui.navigation,model:this.model,collection:this.collection,sort:false});this.navigation.render()},childRefreshed:function(childView){childView.el.id=childView.model.cid;childView.el.classList.add("is-active");this.triggerAll("element:child:refresh",childView)},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this);this.navigation.triggerMethod("destroy")}});module.exports=TabsView},{"./../element-container":17,"./navigation/tabs-navigation":15}],17:[function(require,module,exports){var CompositeView=Marionette.CompositeView.extend({behaviors:{Container:{},Draggable:{},Droppable:{},Editable:{},Movable:{}},modelEvents:{"change:atts":"onChangeAttributes","change:order":"onChangeOrder","change:parent":"onChangeParent","change:setting":"onChangeSetting"},childEvents:{"before:element:ready":"beforeChildElementReady","element:ready":"childElementReady","before:element:refresh":"beforeChildElementRefreshed","element:refresh":"childElementRefreshed","before:element:jsRefresh":"beforeChildElementJSRefreshed","element:jsRefresh":"childElementJSRefreshed","element:change:parent":"childElementChangeParent","element:change:order":"childElementChangeOrder","before:element:destroy":"beforeChildElementDestroyed","element:destroy":"childElementDestroyed"},events:{"before:element:ready":"stopEventPropagation","element:ready":"stopEventPropagation","before:element:refresh":"stopEventPropagation","element:refresh":"stopEventPropagation","before:element:copy":"stopEventPropagation","element:copy":"stopEventPropagation","element:child:change:parent":"onDescendantChangeParent","element:child:change:order":"onDescendantChangeOrder","before:element:destroy":"stopEventPropagation","element:destroy":"stopEventPropagation","element:child:add":"onDescendantAdded","element:child:remove":"onDescendantRemoved","before:element:child:ready":"onBeforeDescendantReady","element:child:ready":"onDescendantReady","before:element:child:refresh":"onBeforeDescendantRefreshed","element:child:refresh":"onDescendantRefreshed","before:element:child:jsRefresh":"onBeforeDescendantJSRefreshed","element:child:jsRefresh":"onDescendantJSRefreshed","before:element:child:destroy":"onBeforeDescendantDestroyed","element:child:destroy":"onDescendantDestroyed","before:navigation:reorder":"stopEventPropagation","navigation:reorder":"onReorder"},onReorder:function(e,cid,index,oldIndex){var view=this.children.findByModelCid(cid);var otherView=this.children.find(function(childView){return childView.model.get("order")==index});if(oldIndex-index<0){view.$el.insertAfter(otherView.$el)}else{view.$el.insertBefore(otherView.$el)}this.children.each(function(childView){var childIndex=childView.$el.index();childView._index=childIndex;childView.model.set("order",childIndex)});view.model.collection.sort();e.stopPropagation()},onChangeAttributes:_.debounce(function(model,atts){model=this.model.toJSON();model.atts=atts?atts:{};var view=this;view.el.classList.add("is-rendering");window.ajax.send("tailor_render",{data:{model:JSON.stringify(model),nonce:window._nonces.render},success:function(response){view.updateTemplate(response.html);var id=view.model.get("id");app.channel.trigger("css:update",id,response.css)},error:function(response){view.updateTemplate('

The template for '+view.cid+" could not be refreshed

");console.log(response)},complete:function(){var isEditing=view.$el.hasClass("is-editing");var isSelected=view.$el.hasClass("is-selected");view.$el.removeClass("is-rendering");view.triggerAll("before:element:refresh",view,model.atts);view.renderTemplate();view.triggerAll("element:refresh",view,model.atts);if(isEditing){view.$el.addClass("is-editing")}if(isSelected){view.$el.addClass("is-selected")}}})},250),onChangeOrder:function(){this.triggerAll("element:change:order",this)},onChangeParent:function(){this.triggerAll("element:change:parent",this)},onChangeSetting:function(setting,refresh){if(refresh){this.triggerAll("before:element:jsRefresh",this,this.model.get("atts"));app.channel.trigger("element:setting:change",setting,this);this.triggerAll("element:jsRefresh",this,this.model.get("atts"))}},initialize:function(){this._isReady=false;this._isBeingDestroyed=false;this.options.childViewContainer=this.model.get("child_container")||null;this.addEventListeners()},addEventListeners:function(){this.listenTo(app.channel,"before:elements:restore",this.onBeforeDestroy)},getChildView:function(child){return Tailor.lookup(child.get("tag"),child.get("type"),"Views")},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return child.get("parent")===this.model.get("id")},attachElContent:function(html){var $el=jQuery(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("draggable",true);this.el.setAttribute("tailor-label",this.model.get("label"));this.el.classList.add("tailor-"+this.model.cid);this.el.title=_l10n.edit_element;return this},getTemplateId:function(){return"tmpl-tailor-"+this.model.get("id")},getTemplate:function(){var el=document.querySelector("#"+this.getTemplateId());var template;if(el){template=_.template(el.innerHTML);el.parentElement.removeChild(el)}else{el=document.querySelector("#tmpl-tailor-"+this.model.get("tag")+"-default");template=_.template(el.innerHTML)}return template},updateTemplate:function(html){var templateId=this.getTemplateId();var el=document.querySelector("#"+templateId);if(!el){el=document.createElement("script");el.setAttribute("type","text/html");el.id=templateId;document.body.appendChild(el)}el.innerHTML=html},renderTemplate:function(){this._ensureViewIsIntact();var $childViewContainer=this.getChildViewContainer(this);var $children=$childViewContainer.contents().detach();this.resetChildViewContainer();this._renderTemplate();$childViewContainer=this.getChildViewContainer(this);$childViewContainer.append($children);return this},onBeforeRender:function(){this.triggerAll("before:element:ready",this)},onDomRefresh:function(){this.$el.find("a").attr({draggable:false,target:"_blank"});this.$el.find("img").attr({draggable:false})},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this)},onDestroy:function(){this.triggerAll("element:destroy",this)},beforeChildElementReady:function(childView){if(this._isReady&&this.children.contains(childView)){this.triggerAll("before:element:child:ready",childView)}},childElementReady:function(childView){if(this.children.contains(childView)){if(!this._isReady){var readyChildren=this.children.filter(function(childView){return childView._isReady}).length;if(this.children.length==readyChildren){this._isReady=true;this.triggerAll("element:ready",this)}}else{this.triggerAll("element:child:ready",childView)}}},beforeChildElementRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("before:element:child:refresh",childView)}},childElementRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:refresh",childView)}},beforeChildElementJSRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("before:element:child:jsRefresh",childView)}},childElementJSRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:jsRefresh",childView)}},childElementChangeOrder:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:change:order",childView)}},childElementChangeParent:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:change:parent",childView)}},beforeChildElementDestroyed:function(childView){if(!this._isBeingDestroyed){this.triggerAll("before:element:child:destroy",childView)}},childElementDestroyed:function(childView){if(!this._isBeingDestroyed){this.triggerAll("element:child:destroy",childView)}},onDescendantAdded:function(e,view){this.triggerAll("element:descendant:add",view);e.stopPropagation()},onDescendantRemoved:function(e,view){this.triggerAll("element:descendant:remove",view);e.stopPropagation()},onBeforeDescendantReady:function(e,view){this.triggerAll("before:element:descendant:ready",view);e.stopPropagation()},onDescendantReady:function(e,view){this.triggerAll("element:descendant:ready",view);e.stopPropagation()},onBeforeDescendantRefreshed:function(e,view){this.triggerAll("before:element:descendant:refresh",view);e.stopPropagation()},onDescendantRefreshed:function(e,view){this.triggerAll("element:descendant:refresh",view);e.stopPropagation()},onBeforeDescendantJSRefreshed:function(e,view){this.triggerAll("before:element:descendant:jsRefresh",view);e.stopPropagation()},onDescendantJSRefreshed:function(e,view){this.triggerAll("element:descendant:jsRefresh",view);e.stopPropagation()},onDescendantChangeOrder:function(e,view){this.triggerAll("element:descendant:change:order",view);e.stopPropagation()},onDescendantChangeParent:function(e,view){this.triggerAll("element:descendant:change:parent",view);e.stopPropagation()},onBeforeDescendantDestroyed:function(e,view){this.triggerAll("before:element:descendant:destroy",view);e.stopPropagation()},onDescendantDestroyed:function(e,view){this.triggerAll("element:descendant:destroy",view);e.stopPropagation()},stopEventPropagation:function(e){e.stopPropagation()},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}},_updateIndices:function(view,increment,index){if(increment){view._index=index;view.model._changing=false;view.model.set("order",index)}this.children.each(function(laterView){if(laterView._index>=view._index){laterView._index+=increment?1:-1; - -laterView.model.set("order",laterView._index)}},this)}});module.exports=CompositeView},{}],18:[function(require,module,exports){var $=window.jQuery,ElementView;ElementView=Marionette.ItemView.extend({className:"element",attributes:{draggable:true},behaviors:{Draggable:{},Droppable:{},Editable:{},Movable:{}},modelEvents:{"change:atts":"onChangeAttributes","change:parent":"onChangeParent","change:setting":"onChangeSetting"},initialize:function(){this._isReady=false;this._isBeingDestroyed=false;this.addEventListeners()},addEventListeners:function(){this.listenTo(app.channel,"before:elements:restore",this.onBeforeDestroy)},getTemplateId:function(){return"tmpl-tailor-"+this.model.get("id")},getTemplate:function(){var el=document.querySelector("#"+this.getTemplateId());var template;if(el){template=_.template(el.innerHTML);el.parentElement.removeChild(el)}else{el=document.querySelector("#tmpl-tailor-"+this.model.get("tag")+"-default");template=_.template(el.innerHTML)}return template},attachElContent:function(html){var $el=$(html);var el=$el[0];this.$el.replaceWith(el);this.setElement(el);this.el.setAttribute("draggable",true);this.el.setAttribute("tailor-label",this.model.get("label"));this.el.classList.add("tailor-"+this.model.id);this.el.title=_l10n.edit_element;return this},updateTemplate:function(html){var templateId=this.getTemplateId();var el=document.querySelector("#"+templateId);if(!el){el=document.createElement("script");el.setAttribute("type","text/html");el.id=templateId;document.body.appendChild(el)}el.innerHTML=html},onChangeAttributes:_.debounce(function(model,atts){var view=this;model=model.toJSON();if(atts){model.atts=atts}view.el.classList.add("is-rendering");window.ajax.send("tailor_render",{data:{model:JSON.stringify(model),nonce:window._nonces.render},success:function(response){view.updateTemplate(response.html);app.channel.trigger("css:update",view.model.get("id"),response.css)},error:function(response){view.updateTemplate('

The template for '+view.cid+" could not be refreshed

");console.log(response)},complete:function(){var isEditing=view.$el.hasClass("is-editing");var isSelected=view.$el.hasClass("is-selected");view.$el.removeClass("is-rendering");view.triggerAll("before:element:refresh",view,model.atts);view.render();view.triggerAll("element:refresh",view,model.atts);if(isEditing){view.$el.addClass("is-editing")}if(isSelected){view.$el.addClass("is-selected")}}})},500),onChangeSetting:function(setting,refresh){if(refresh){this.triggerAll("before:element:jsRefresh",this,this.model.get("atts"));app.channel.trigger("element:setting:change",setting,this);this.triggerAll("element:jsRefresh",this,this.model.get("atts"))}},onChangeParent:function(){this.triggerAll("element:change:parent",this)},onBeforeRender:function(){this.triggerAll("before:element:ready",this)},onDomRefresh:function(){var view=this;this.$el.find("a").attr({draggable:false,target:"_blank"});this.$el.find("[onchange]").removeAttr("onchange");this.$el.find("img").attr({draggable:false});this.$el.imagesLoaded(function(){view._isReady=true;if(view.el.classList.contains("tailor-widget")&&0==view.$el.children().innerHeight()){var el=document.querySelector("#tmpl-tailor-element-empty");if(el){view.$el.html(el.innerHTML)}}view.triggerAll("element:ready",view)})},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this)},onDestroy:function(){this.triggerAll("element:destroy",this)},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}}});module.exports=ElementView},{}],19:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Carousel;Carousel=Components.create({slickActive:false,getDefaults:function(){return{items:".tailor-carousel__item",prevArrow:'',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,arrows:false,dots:true,fade:false}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.slick()},slick:function(){var component=this;component.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){this.$wrap.slick("refresh")},unSlick:function(){this.$wrap.slick("unslick")},onMove:function(){if(this.slickActive){this.refreshSlick()}},onBeforeCopy:function(){if(this.slickActive){this.unSlick()}},onCopy:function(){if(!this.slickActive){this.slick()}},onBeforeRefresh:function(){if(this.slickActive){this.unSlick()}},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){if(this.slickActive){this.unSlick()}},onResize:function(){if(this.slickActive){this.refreshSlick()}}});$.fn.tailorSimpleCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSimpleCarousel");if(!instance){$.data(this,"tailorSimpleCarousel",new Carousel(this,options,callbacks))}})}},{}],20:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Carousel;Carousel=Components.create({getDefaults:function(){return{items:".tailor-carousel__item",prevArrow:'',nextArrow:'',adaptiveHeight:false,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,initialSlide:0,autoplay:false,arrows:false,dots:false,fade:false,infinite:false}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.slickAt(0,this.addEventListeners)},slickAt:function(index,callback){this.querySelectors();var numberItems=this.$items.length;if(!numberItems){return}index=Math.min(index,numberItems-1);if(index "+component.options.items);component.$dots=component.$el.children(".slick-dots").find(" > li");component.$dots.on("click",function(e){var $dot=$(e.currentTarget);component.currentSlide=$dot.data("id");component.$wrap.slick("slickGoTo",$dot.index());e.preventDefault()});if(!component.currentSlide){var $activeSlide=component.$items.filter(function(){return this.classList.contains("slick-current")});component.currentSlide=$activeSlide.length?$activeSlide.id:component.$items[0].id}},updateDots:function(index){this.$dots.each(function(i,el){if(index==i){el.classList.add("slick-active")}else{el.classList.remove("slick-active")}});this.$dots.toggle(this.$dots.length/this.options.slidesToShow>1)},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onBeforeRefresh:function(){this.unSlick()},onRefresh:function(){this.refreshSlick()},onJSRefresh:function(){this.refreshSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onAddChild:function(){this.refreshSlick()},onRemoveChild:function(e,childView){childView.$el.detach();this.refreshSlick()},onBeforeReadyChild:function(e,childView){this.unSlick()},onReadyChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeReorderChild:function(){this.unSlick()},onReorderChild:function(e,cid,index,oldIndex){this.querySelectors();this.slickAt(index)},onBeforeRefreshChild:function(){this.unSlick()},onRefreshChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeJSRefreshChild:function(){this.unSlick()},onJSRefreshChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeDestroyChild:function(){this.unSlick()},onDestroyChild:function(e,childView){var index=childView.$el.index();childView.$el.remove();this.slickAt(index)},onAddDescendant:function(){this.refreshSlick()},onRemoveDescendant:function(){this.refreshSlick()},onReadyDescendant:function(){this.refreshSlick()},onRefreshDescendant:function(){this.refreshSlick()},onJSRefreshDescendant:function(){this.refreshSlick()},onDestroyDescendant:function(){this.refreshSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorCarousel");if(!instance){$.data(this,"tailorCarousel",new Carousel(this,options,callbacks))}})}},{}],21:[function(require,module,exports){var ElementCollection=Backbone.Collection.extend({comparator:"order",model:function(attrs,options){var Model=Tailor.lookup(attrs.tag,attrs.type,"Models");return new Model(attrs,options)},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"change:parent",this.onChangeParent);this.listenTo(this,"add",this.onAdd);this.listenTo(this,"destroy",this.onDestroy);this.listenTo(this,"container:collapse",this.onCollapse);this.listenTo(this,"reset",this.onReset)},getElementDefinitions:function(){return this.library||app.channel.request("sidebar:library")},applyDefaults:function(model){if(model instanceof Backbone.Model){model=model.toJSON()}var item=this.getElementDefinitions().findWhere({tag:model.tag});var defaults={label:item.get("label"),type:item.get("type")};var child=item.get("child");if(child){defaults.child=child}var childViewContainer=item.get("child_container");if(childViewContainer){defaults.child_container=childViewContainer}model.atts=model.atts||{};_.each(item.get("settings"),function(setting){if(!_.isEmpty(setting["value"])&&!model.atts.hasOwnProperty(setting["id"])){model.atts[setting["id"]]=setting["value"]}});return _.extend(model,defaults)},getParent:function(model){return this.findWhere({id:model.get("parent")})},getChildren:function(model){return this.where({parent:model.get("id")})},getSiblings:function(model){return this.where({parent:model.get("parent")})},hasSelectedParent:function(model){var selected=app.channel.request("canvas:element:selected");if(!selected||model===selected){return false}var parentId=model.get("parent");var parent=this.findWhere({id:parentId});while("undefined"!==typeof parent){if(selected===parent){return true}parentId=parent.get("parent");parent=this.get(parentId)}return false},onChangeParent:function(model){var parent=this.get(model.get("parent"));var previousParent=this.get(model.previous("parent"));this.sort({silent:true});this._checkParent(previousParent);if("tailor_column"===model.get("tag")){this._reBalanceColumns(parent);this._reBalanceColumns(previousParent)}},onAdd:function(model,collection,options){if("tailor_column"==model.get("tag")){this._reBalanceColumns(this.get(model.get("parent")))}},onDestroy:function(model){var parent=this.get(model.get("parent"));this._checkParent(parent);var children=this.where({parent:model.get("id")});if(children.length){_.each(children,function(child){child.trigger("destroy",child,this)},this)}if(parent&&"tailor_column"===model.get("tag")){this._reBalanceColumns(parent)}if(0===this.length){this.onEmpty()}},onReset:function(){if(0===this.length){this.onEmpty()}},onEmpty:function(){var section=this.createSection(0);this.create([{tag:"tailor_content",atts:{},parent:section.get("id"),order:0}])},onCollapse:function(model,children){var parentId=model.get("parent");_.each(children,function(child){child.set("parent",parentId)},this)},add:function(models,options){if(_.isArray(models)){_.each(models,this.applyDefaults.bind(this))}else{this.applyDefaults(models)}return this.set(models,_.extend({merge:false},options,{add:true,remove:false}))},create:function(models,options){options=options||{};return this.add(models,options)},createSection:function(order){return _.first(this.create([{tag:"tailor_section",order:order}],{at:order}))},createRow:function(parentId,order){var row=_.first(this.create([{tag:"tailor_row",parent:parentId,order:order}],{}));return this.create([{tag:"tailor_column",atts:{width:"50%"},parent:row.get("id"),order:0},{tag:"tailor_column",atts:{width:"50%"},parent:row.get("id"),order:1}])},createColumn:function(parentId,order){return _.first(this.create([{tag:"tailor_column",parent:parentId,order:order}]))},createContainer:function(model,parentId,order,descendants){var tag=model.get("tag");var container=_.first(this.create([{tag:tag,parent:parentId,order:order}],{at:order,silent:true}));var childTag=model.get("child");var children=this.create([{tag:childTag,parent:container.get("id"),order:0},{tag:childTag,parent:container.get("id"),order:1}],{silent:true});if(descendants){_.first(descendants).set("parent",_.first(children).get("id"),{silent:true});_.last(descendants).set("parent",_.last(children).get("id"),{silent:true})}this.trigger("add",container,this,{})},createWrapper:function(tag,parentId,order,child){var wrapper=_.first(this.create([{tag:tag,parent:parentId,order:order}],{silent:true}));if("undefined"==typeof child){this.create([{tag:"tailor_content",parent:wrapper.get("id"),order:0}],{silent:true})}this.trigger("add",wrapper,this,{});if("undefined"!=typeof child){this.insertChild(child,wrapper)}return wrapper},createChild:function(model){var child=_.first(this.create([{tag:model.get("child"),parent:model.get("id"),order:this.getChildren(model).length}],{silent:true}));this.create([{tag:"tailor_content",parent:child.get("id"),order:0}],{silent:true});this.trigger("add",child,this,{});return child},insertChild:function(child,parent){if(!child){return}if(child.get("parent")!==parent.get("id")){child.trigger("remove:child")}parent.trigger("insert",child);child.trigger("add:child");child.set("parent",parent.get("id"))},_reBalanceColumns:function(model){var children=this.where({parent:model.get("id")});var numberChildren=children.length;_.each(children,function(child){var atts=_.clone(child.get("atts"));atts["width"]=Math.round(parseFloat(1/numberChildren)*1e3)/10+"%";delete atts["width_tablet"];delete atts["width_mobile"];child.set("atts",atts,{silent:true});child.trigger("change:width",child,atts)},this)},_checkParent:function(model){if(!model){return}if("container"==model.get("type")){this._checkCollapsibleContainer(model)}this._checkChildren(model)},_checkChildren:function(model){var children=this.where({parent:model.get("id")});if(0===children.length){model.trigger("destroy",model)}},_checkCollapsibleContainer:function(model){var childTag=this.getElementDefinitions().findWhere({tag:model.get("tag")}).get("child");var containerId=model.get("id");var children=this.filter(function(element){return containerId===element.get("parent")&&childTag===element.get("tag")});if(0===children.length){model.trigger("container:collapse",model,this.where({parent:containerId}))}else if(1===children.length){var child=_.first(children);if("tailor_row"===model.get("tag")){child.trigger("container:collapse",child,this.where({parent:child.get("id")}))}}}});module.exports=ElementCollection},{}],22:[function(require,module,exports){var ChildModel=require("./../element-child"),ColumnModel;ColumnModel=ChildModel.extend({validTarget:function(that,region){if(_.contains(["tailor_section","tailor_row"],that.get("tag"))||!_.contains(["left","right"],region)){return false}if("child"==that.get("type")&&that.get("tag")!=this.get("tag")){return false}var siblings=this.collection.getSiblings(this);return that.get("parent")==this.get("parent")||siblings.length<6}});module.exports=ColumnModel},{"./../element-child":28}],23:[function(require,module,exports){var ChildModel=require("./../element-child"),GridItemModel;GridItemModel=ChildModel.extend({validTarget:function(that,region){if("tailor_section"==that.get("tag")||_.contains(["top","bottom","center"],region)){return false}var parent=this.collection.getParent(this);if(parent.get("tag")==that.get("tag")){return false}return that.get("tag")==this.get("tag")}});module.exports=GridItemModel},{"./../element-child":28}],24:[function(require,module,exports){var ContainerModel=require("./../element-container"),CarouselModel;CarouselModel=ContainerModel.extend({createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();var $navigation=view.$el.find(".slick-dots").detach();this.appendTemplate(id,view);$childViewContainer.append($children);$navigation.insertAfter($childViewContainer);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=CarouselModel},{"./../element-container":30}],25:[function(require,module,exports){var ContainerModel=require("./../element-container"),RowModel;RowModel=ContainerModel.extend({validTarget:function(that,region){if("child"==that.get("type")||"tailor_section"==that.get("tag")||"center"==region){return false}return _.contains(["top","bottom"],region)&&"tailor_column"!=that.get("tag")}});module.exports=RowModel},{"./../element-container":30}],26:[function(require,module,exports){var ContainerModel=require("./../element-container"),TabsModel;TabsModel=ContainerModel.extend({createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();var $navigation=view.$el.find(".tailor-tabs__navigation");var $navigationItems=$navigation.children().detach();this.appendTemplate(id,view);$childViewContainer.append($children);$navigation.append($navigationItems);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=TabsModel},{"./../element-container":30}],27:[function(require,module,exports){var Model;Backbone.Model.prototype.set=_.wrap(Backbone.Model.prototype.set,function(oldSet,key,val,options){if(key==null)return this;var attrs;if(typeof key==="object"){attrs=key;options=val}else{(attrs={})[key]=val}options||(options={});var ret=oldSet.call(this,attrs,options);if(this._tracking){_.each(attrs,_.bind(function(val,key){if(_.isEqual(this._original[key],val)){delete this._unsaved[key]}else{this._unsaved[key]=val}},this))}return ret});Model=Backbone.Model.extend({_tracking:false,_original:{},_unsaved:{},defaults:function(){return{id:this.cid,tag:"",label:"",atts:{},parent:"",order:0,collection:"element"}},isTracking:function(){return this._tracking},startTracking:function(){this._tracking=true;this.resetTracking();return this},stopTracking:function(){this._tracking=false;this._original={};this._unsaved={};return this},resetTracking:function(){this._original=_.clone(this.attributes);this._unsaved={};return this},resetAttributes:function(){if(!this._tracking){return}this.attributes=this._original;this.resetTracking();this.trigger("change:atts",this,this.get("atts"));return this},toShortcode:function(){var tag=this.get("tag");var atts=this.get("atts");var content="";var shortcode="["+tag;_.each(atts,function(attr,id){if(attr){if("content"===id){content=attr}else{if(_.isNumber(id)){if(/\s/.test(attr)){shortcode+=' "'+attr+'"'}else{shortcode+=" "+attr}}else{shortcode+=" "+id+'="'+attr+'"'}}}},this);return shortcode+"]"+content+"[/"+tag+"]"},insertBefore:function(view){this.trigger("remove:child");this.trigger("insert:before",view);this.trigger("add:child");this.set("parent",view.model.get("parent"))},insertAfter:function(view){this.trigger("remove:child");this.trigger("insert:after",view);this.trigger("add:child");this.set("parent",view.model.get("parent"))},columnBefore:function(view){var model=view.model;var parent=model.get("parent");if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(parent,model.get("order")-1);this.collection.insertChild(this,column)}else{var columns=this.collection.createRow(parent,model.get("order"));this.collection.insertChild(this,_.first(columns));this.collection.insertChild(model,_.last(columns))}},columnAfter:function(view){var model=view.model;var parent=model.get("parent");if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(parent,model.get("order"));this.collection.insertChild(this,column)}else{var columns=this.collection.createRow(parent,model.get("order"));this.collection.insertChild(model,_.first(columns));this.collection.insertChild(this,_.last(columns))}},beforeCopyElement:function(view){var el=view.el;view.triggerAll("before:element:copy",view);el.classList.remove("is-dragging");el.classList.remove("is-hovering");el.classList.remove("is-selected");el.classList.remove("is-editing")},appendTemplate:function(id,view){var oldId=view.model.get("id");var template=document.createElement("script");template.setAttribute("type","text/html");template.id="tmpl-tailor-"+id;template.innerHTML=view.el.outerHTML.replace(oldId,id);document.body.appendChild(template)},afterCopyElement:function(id,view){var oldId=view.model.get("id");view.$el.trigger("element:copy",view);app.channel.trigger("css:copy",oldId,id)}});module.exports=Model},{}],28:[function(require,module,exports){var CompositeModel=require("./element-composite"),ChildModel;ChildModel=CompositeModel.extend({validTarget:function(that,region){if("tailor_section"==that.get("tag")||_.contains(["left","right","center"],region)){return false}var parent=this.collection.getParent(this);if(parent.get("tag")==that.get("tag")){return false}return that.get("tag")==this.get("tag")},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.insertBefore);this.listenTo(this,"element:move:right",this.insertAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyBefore);this.listenTo(this,"element:copy:right",this.copyAfter)}});module.exports=ChildModel},{"./element-composite":29}],29:[function(require,module,exports){var BaseModel=require("./element-base"),CompositeModel;CompositeModel=BaseModel.extend({cloneContainer:function(sourceView,parent,index){var collection=this.collection;var clone=sourceView.model.clone();clone.set("id",clone.cid);clone.set("parent",parent);clone.set("order",index);this.createTemplate(clone.cid,sourceView);var clonedChildren=this.cloneChildren(sourceView.children,clone,[]);collection.add(clonedChildren,{silent:true});collection.add(clone);sourceView.triggerMethod("element:refresh")},cloneChildren:function(childViews,parent,clones){if(childViews.length){childViews.each(function(childView){var clone=childView.model.clone();clone.set("id",clone.cid);clone.set("parent",parent.get("id"));clone.createTemplate(clone.cid,childView);clones.push(clone);if(childView.children){this.cloneChildren(childView.children,clone,clones)}},this)}return clones},copyBefore:function(targetView,sourceView){this.cloneContainer(sourceView,targetView.model.get("parent"),targetView.model.get("order")-1)},copyAfter:function(targetView,sourceView){this.cloneContainer(sourceView,targetView.model.get("parent"),targetView.model.get("order"))},copyColumnBefore:function(targetView,sourceView){var parent=targetView.model.get("parent");if("tailor_column"===targetView.model.get("tag")){var column=this.collection.createColumn(parent,targetView.model.get("order")-1);this.cloneContainer(sourceView,column.get("id"),0)}else{var columns=this.collection.createRow(parent,targetView.model.get("order"));this.collection.insertChild(targetView.model,_.last(columns));this.cloneContainer(sourceView,_.first(columns).get("id"),0)}},copyColumnAfter:function(targetView,sourceView){var parent=targetView.model.get("parent");if("tailor_column"===targetView.model.get("tag")){var column=this.collection.createColumn(parent,targetView.model.get("order"));this.cloneContainer(sourceView,column.get("id"),0)}else{var columns=this.collection.createRow(parent,targetView.model.get("order"));this.collection.insertChild(targetView.model,_.first(columns));this.cloneContainer(sourceView,_.last(columns).get("id"),0)}},createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();this.appendTemplate(id,view);$childViewContainer.append($children);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=CompositeModel},{"./element-base":27}],30:[function(require,module,exports){var CompositeModel=require("./element-composite"),ContainerModel;ContainerModel=CompositeModel.extend({validTarget:function(that,region){if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("center"==region){return"container"!=that.get("type")}if(_.contains(["wrapper","child"],parent.get("type"))){if(_.contains(["top","bottom"],region)){return _.contains(["tailor_section","tailor_column"],parent.get("tag"))||!_.contains(["container","wrapper","child"],that.get("type"))}return"tailor_section"==parent.get("tag")||!_.contains(["left","right"],region)}return"container"!=that.get("type")},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter)}});module.exports=ContainerModel},{"./element-composite":29}],31:[function(require,module,exports){var CompositeModel=require("./element-composite"),WrapperModel;WrapperModel=CompositeModel.extend({validTarget:function(that,region){if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))||"center"==region){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("child"==parent.get("type")&&"tailor_column"!=parent.get("tag")){return"container"!=that.get("type")&&!_.contains(["left","right"],region)}if(_.contains(["container","wrapper","child"],parent.get("type"))){return"tailor_section"==parent.get("tag")||!_.contains(["left","right"],region)}return true},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter);this.listenTo(this,"element:move:center",this.createChild);this.listenTo(this,"element:copy:center",this.copyChild)},createChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;this.createTemplate(sourceView.model.get("id"),sourceView);this.collection.createWrapper(childTag,id,numberChildren,sourceView.model)},copyChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;var wrapper=this.collection.createWrapper(childTag,id,numberChildren,false);this.cloneContainer(sourceView,wrapper.get("id"),0)}});module.exports=WrapperModel},{"./element-composite":29}],32:[function(require,module,exports){var BaseModel=require("./element-base"),ElementModel;ElementModel=BaseModel.extend({validTarget:function(that,region,threshold){if(threshold<20){return false}if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))||"center"==region){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("child"==parent.get("type")&&"tailor_column"!=parent.get("tag")){return"container"!=that.get("type")&&!_.contains(["left","right"],region)}if(_.contains(["wrapper","child"],parent.get("type"))){if(_.contains(["top","bottom"],region)){return _.contains(["tailor_section","tailor_column"],parent.get("tag"))||!_.contains(["container","wrapper","child"],that.get("type"))}return"tailor_section"==parent.get("tag")||_.contains(["left","right"],region)}return true},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter);this.listenTo(this,"element:move:center",this.createChild);this.listenTo(this,"element:copy:center",this.copyChild)},copyBefore:function(targetView,sourceView){var clone=sourceView.model.clone();var index=targetView.model.get("order")-1;clone.set("id",clone.cid);clone.set("parent",targetView.model.get("parent"));clone.set("order",index);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},copyAfter:function(targetView,sourceView){var clone=sourceView.model.clone();var index=targetView.model.get("order");clone.set("id",clone.cid);clone.set("parent",targetView.model.get("parent"));clone.set("order",index);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},copyColumnBefore:function(targetView,sourceView){var model=targetView.model;var clone=sourceView.model.clone();clone.set("id",clone.cid);this.createTemplate(clone.cid,sourceView);if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(model.get("parent"),model.get("order")-1);clone.set("parent",column.get("id"));this.collection.add(clone)}else{var columns=this.collection.createRow(model.get("parent"),model.get("order"));this.collection.insertChild(model,_.last(columns));clone.set("parent",_.first(columns).get("id"));this.collection.add(clone)}},copyColumnAfter:function(targetView,sourceView){var model=targetView.model;var clone=sourceView.model.clone();clone.set("id",clone.cid);this.createTemplate(clone.cid,sourceView); - -if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(model.get("parent"),model.get("order"));clone.set("parent",column.get("id"));this.collection.add(clone)}else{var columns=this.collection.createRow(model.get("parent"),model.get("order"));this.collection.insertChild(model,_.first(columns));clone.set("parent",_.last(columns).get("id"));this.collection.add(clone)}},createChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;this.appendTemplate(sourceView.model.get("id"),sourceView);this.collection.createWrapper(childTag,id,numberChildren,sourceView.model)},copyChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;var wrapper=this.collection.createWrapper(childTag,id,numberChildren,false);var clone=sourceView.model.clone();clone.set("id",clone.cid);clone.set("parent",wrapper.get("id"));clone.set("order",0);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);this.appendTemplate(id,view);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=ElementModel},{"./element-base":27}],33:[function(require,module,exports){var WrapperModel=require("./../element-wrapper"),SectionModel;SectionModel=WrapperModel.extend({validTarget:function(that,region){return"tailor_section"==that.get("tag")&&!_.contains(["left","right","center"],region)}});module.exports=SectionModel},{"./../element-wrapper":31}],34:[function(require,module,exports){var CanvasRegion=Backbone.Marionette.Region.extend({initialize:function(){this.listenTo(app.channel,"canvas:dragstart",this.onDragStart);this.listenTo(app.channel,"canvas:dragend",this.onDragEnd)},onDragStart:function(view,region,options){this.el.classList.add("is-active")},onDragEnd:function(view,region,options){this.el.classList.remove("is-active")}});module.exports=CanvasRegion},{}],35:[function(require,module,exports){var $=Backbone.$,$win=$(window),$doc=$(document),CanvasCollectionView=require("./show/canvas-view"),CanvasModule;CanvasModule=Marionette.Module.extend({onStart:function(){this._model=null;this._isDragging=false;this.collection=app.channel.request("canvas:elements");this.addEventListeners();this.showCanvas();app.channel.trigger("module:canvas:ready",this)},addEventListeners:function(){this.listenTo(app.channel,"canvas:dragstart",this.onDragStart);this.listenTo(app.channel,"canvas:dragover",this.onDragOver);this.listenTo(app.channel,"canvas:dragend",this.onDragEnd);this.listenTo(app.channel,"canvas:drop",this.onDrop);$doc.on("click dragover",this.reset.bind(this));$win.on("resize",this.reset.bind(this))},showCanvas:function(){app.canvasRegion.show(new CanvasCollectionView({collection:this.collection}))},onDragStart:function(e,view){var collection=view.model.collection;if("function"===typeof collection.hasSelectedParent&&collection.hasSelectedParent(view.model)){return}this._view=view;this._model=view.model;this._isDragging=true;view.el.classList.add("is-dragging");if("element"==view.model.get("collection")){var testVar=window.DataTransfer||window.Clipboard;if("setDragImage"in testVar.prototype){var dragImage=document.createElement("img");dragImage.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";e.dataTransfer.setDragImage(dragImage,0,0)}}e.dataTransfer.effectAllowed="copyMove";e.dataTransfer.setData("Text",this._model.cid);e.stopPropagation()},onDragOver:function(e,view){if(!this._isDragging){return}if(e.pageY){var scrollY=window.scrollY||document.documentElement.scrollTop;if(e.pageY-scrollY<40){window.scrollTo(0,scrollY-20)}else if(scrollY+window.innerHeight-e.pageY<40){window.scrollTo(0,scrollY+20)}}var action="element"===this._model.get("collection")&&e.shiftKey?"copy":"move";if("move"===action&&view.model===this._model){this.reset();e.stopPropagation();return}var region=this._getDropRegion(e,view);if(!view.model.validTarget(this._model,region)){return}e.dataTransfer.dropEffect=action;app.channel.trigger("canvas:guide",view,region);e.preventDefault();e.stopPropagation()},onDrop:function(e,view){if(!this._isDragging){return}var model=this._model;var region=this._getDropRegion(e,view);if(!view.model.validTarget(model,region)){return}var action;if("element"===model.get("collection")){action=e.shiftKey?"copy":"move";if("move"===action&&view.model===model){return}}else{action="add"}model.trigger("element:"+action+":"+region,view,this._view);app.channel.trigger("element:"+action,model);this.collection.sort({silent:true});e.preventDefault();e.stopPropagation()},onDragEnd:function(e,view){if(!this._isDragging){return}this._isDragging=false;this._view.el.classList.remove("is-dragging");this.reset()},reset:function(){app.channel.trigger("canvas:reset")},_getPoint:function(e){if(e.targetTouches){return{x:e.targetTouches[0].clientX,y:e.targetTouches[0].clientY}}return{x:e.clientX,y:e.clientY}},_getDropRegion:function(e,view){var point=this._getPoint(e);var rect=view.el.getBoundingClientRect();var width=rect.width/2;var height=rect.height/2;var top=rect.top+(rect.height-height)/2;var left=rect.left+(rect.width-width)/2;if(left<=point.x&&point.x<=left+width&&top<=point.y&&point.y<=top+height){return"center"}else{var x=(point.x-(rect.left+width))/width;var y=(point.y-(rect.top+height))/height;if(Math.abs(x)>Math.abs(y)){return x>0?"right":"left"}return y>0?"bottom":"top"}}});module.exports=CanvasModule},{"./show/canvas-view":36}],36:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({behaviors:{Container:{}},getChildView:function(){return Tailor.lookup("tailor_section","wrapper","Views")},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return!child.get("parent")},_updateIndices:function(view,increment,index){if(increment){view._index=index;view.model._changing=false;view.model.set("order",index)}this.children.each(function(laterView){if(laterView._index>=view._index){laterView._index+=increment?1:-1;laterView.model.set("order",laterView._index)}},this)},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}}})},{}],37:[function(require,module,exports){var Stylesheet=require("./stylesheet"),CSSModule;CSSModule=Marionette.Module.extend({onStart:function(options){this.stylesheets=[];this.collection=app.channel.request("canvas:elements");this.createSheets(options.mediaQueries||{});this.addRules(options.cssRules||{});this.addEventListeners();app.channel.trigger("module:css:ready",this)},addEventListeners:function(){this.listenTo(app.channel,"css:add",this.addRules);this.listenTo(app.channel,"css:delete",this.deleteRules);this.listenTo(app.channel,"css:update",this.updateRules);this.listenTo(app.channel,"css:copy",this.copyRules);this.listenTo(app.channel,"css:clear",this.clearRules);this.listenTo(this.collection,"destroy",this.onDestroy)},createSheet:function(id,min,max){var media="only screen";if(min){media+=" and (min-width: "+min+")"}if(max){media+=" and (max-width: "+max+")"}return new Stylesheet(id,media)},createSheets:function(mediaQueries){_.each(mediaQueries,function(atts,id){if(!_.isEmpty(atts.min)){if(!_.isEmpty(atts.max)){this.stylesheets[id+"-up"]=this.createSheet(id+"-up",atts.min);this.stylesheets[id]=this.createSheet(id,atts.min,atts.max)}else{this.stylesheets[id]=this.createSheet(id,atts.min)}}else{if(!_.isEmpty(atts.max)){this.stylesheets[id]=this.createSheet(id,null,atts.max)}else{this.stylesheets[id]=this.createSheet(id)}}},this);app.channel.trigger("module:css:stylesheets:ready",this)},getSheet:function(id){if(this.stylesheets.hasOwnProperty(id)){return this.stylesheets[id]}return false},addRules:function(cssRules){for(var queryId in cssRules){if(cssRules.hasOwnProperty(queryId)){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].addRules(cssRules[queryId])}}}},clearRules:function(){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].clearRules()}}},copyRules:function(elementId,newElementId){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){var rules=this.stylesheets[queryId].getRules(elementId);if(rules.length){for(var rule in rules){if(rules.hasOwnProperty(rule)){rules[rule].selectors=rules[rule].selectors.replace(new RegExp(elementId,"g"),newElementId)}}var rulesSet={};rulesSet[queryId]={};rulesSet[queryId][newElementId]=rules;this.addRules(rulesSet)}}}},deleteRules:function(elementId,settingId){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].deleteRules(elementId,settingId)}}},updateRules:function(elementId,cssRules){this.deleteRules(elementId);this.addRules(cssRules)},onReset:function(){this.clearRules()},onDestroy:function(model){this.deleteRules(model.get("id"))}});module.exports=CSSModule},{"./stylesheet":38}],38:[function(require,module,exports){function Stylesheet(id,media){this.id=id;this.initialize(media)}Stylesheet.prototype={initialize:function(media){this.stylesheet=this.createStylesheet(media);this.sheet=this.stylesheet.sheet;this.lookup=[]},createStylesheet:function(media){var style=document.createElement("style");style.appendChild(document.createTextNode(""));media=media||"screen";style.setAttribute("media",media);style.setAttribute("id","tailor-"+this.id);document.head.appendChild(style);return style},addRules:function(ruleSet){for(var elementId in ruleSet){if(ruleSet.hasOwnProperty(elementId)){this.lookup=this.lookup||[];for(var i in ruleSet[elementId]){if(ruleSet[elementId].hasOwnProperty(i)){this.addRule(elementId,ruleSet[elementId][i])}}}}},addRule:function(elementId,rule){if(this.checkRule(rule)){var selectors=Tailor.CSS.parseSelectors(rule["selectors"],elementId);var declarations=Tailor.CSS.parseDeclarations(rule["declarations"]);if(!_.isEmpty(declarations)){var settingId=rule["setting"];Tailor.CSS.addRule(this.sheet,selectors,declarations,this.lookup.length);this.lookup.push({elementId:elementId,settingId:settingId})}}},checkRule:function(rule){return _.has(rule,"selectors")&&_.has(rule,"declarations")&&_.has(rule,"setting")},getRules:function(elementId){var rules=[];for(var i=0;i-1){rules.push({selectors:rule.selectorText,declarations:rule.style.cssText,setting:this.lookup[i]["settingId"]||""})}}}return rules},deleteRules:function(elementId,settingId){for(var i=0;i1){module.collection.add(parents,{at:index+1})}else{parents[0].parent=parent;parents[0].order=index;module.collection.add(parents)}app.channel.trigger("template:add",model)}canvas.classList.remove("is-loading")}})}};app.channel.on("template:load",api.loadTemplate);app.channel.trigger("module:templates:ready",this)}});module.exports=TemplateModule},{}],41:[function(require,module,exports){var SelectRegion=Backbone.Marionette.Region.extend({onShow:function(view,region,options){view._view.el.classList.add("is-selected")},onEmpty:function(view,region,options){view._view.el.classList.remove("is-selected")}});module.exports=SelectRegion},{}],42:[function(require,module,exports){var GuideView=Marionette.ItemView.extend({template:false,position:function(view,drop){var $el=view.$el;var offset=$el.offset();var parentOffset=this.$el.offsetParent().offset();this.el.style.visibility="visible";this.el.className="guide guide--"+drop+" guide--"+view.model.get("tag");this.el.style.left=offset.left-parentOffset.left+"px";this.el.style.top=offset.top-parentOffset.top+"px";this.el.style.width=$el.outerWidth()+"px";this.el.style.height=$el.outerHeight()+"px";this.el.style.opacity=1},reset:function(){this.el.style="";this.el.style.visibility="hidden";this.el.style.opacity=0}});module.exports=GuideView},{}],43:[function(require,module,exports){var SelectMenuItemView=Marionette.ItemView.extend({tagName:"div",className:"select__item",events:{click:"onClick"},getTemplate:function(){return _.template("<%= label %>")},onClick:function(e){if(0===this._index){this.triggerMethod("toggle")}else{this.model.trigger("select")}e.stopPropagation()}});module.exports=SelectMenuItemView},{}],44:[function(require,module,exports){var SelectMenuItemView=require("./select-menu-item"),SelectMenuView;SelectMenuView=Marionette.CompositeView.extend({className:"select",childView:SelectMenuItemView,childViewContainer:".select__menu",ui:{add:".js-add",edit:".js-edit",copy:".js-copy","delete":".js-delete"},events:{"click @ui.add":"addElement","click @ui.edit":"editElement","click @ui.copy":"copyElement","click @ui.delete":"deleteElement"},modelEvents:{destroy:"destroy"},childEvents:{toggle:"toggleMenu"},template:"#tmpl-tailor-tools-select",serializeData:function(){var data=Backbone.Marionette.CompositeView.prototype.serializeData.apply(this,arguments);data.type=this.model.get("type");data.siblings=this.collection.where({parent:this.model.get("parent")}).length;return data},initialize:function(options){this._view=options.view},_filteredSortedModels:function(){var models=[];var model=this.model;while("undefined"!==typeof model){models.push(model);model=this.collection.get(model.get("parent"))}return models},onDomRefresh:function(){var thisRect=this.el.parentNode.getBoundingClientRect();var thatRect=this._view.el.getBoundingClientRect();var style=getComputedStyle(this._view.el,null);var borderTop=parseInt(style.getPropertyValue("border-top-width"),10);var borderRight=parseInt(style.getPropertyValue("border-right-width"),10);var borderBottom=parseInt(style.getPropertyValue("border-bottom-width"),10);var borderLeft=parseInt(style.getPropertyValue("border-left-width"),10);var left=Math.round(parseFloat(thatRect.left))+borderLeft;var right=Math.min(window.innerWidth+1,Math.round(thatRect.right)-borderRight);var width=right-left;this.el.style.top=Math.round(parseFloat(thatRect.top-parseFloat(thisRect.top)))+borderTop+"px";this.el.style.left=left-thisRect.left+"px";this.el.style.width=width+"px";this.el.style.height=Math.round(parseFloat(thatRect.height))-borderTop-borderBottom+"px";var controls=this.el.querySelector(".select__controls");var menu=this.el.querySelector(".select__menu");if(menu&&controls){var menuRect=menu.getBoundingClientRect();var controlsRect=controls.getBoundingClientRect();if(menuRect.width+controlsRect.width>parseInt(this.el.style.width,10)){this.el.classList.add("is-minimal")}}},addElement:function(){var child=this.model.collection.createChild(this.model);child.set("collection","library",{silent:true});app.channel.trigger("element:add",child)},editElement:function(){app.channel.trigger("modal:open",this.model)},copyElement:function(){this.model.copyAfter(this._view,this._view);app.channel.trigger("element:copy",this.model)},deleteElement:function(){this.model.trigger("destroy",this.model);app.channel.trigger("element:delete",this.model)},toggleMenu:function(){this.$el.toggleClass("is-expanded")}});module.exports=SelectMenuView},{"./select-menu-item":43}],45:[function(require,module,exports){var GuideView=require("./show/guide"),SelectorView=require("./show/select-menu"),ToolsModule;ToolsModule=Marionette.Module.extend({onStart:function(){var guide=new GuideView({el:"#guide"}).render();var api={positionGuide:function(view,drop){guide.position(view,drop)},selectElement:function(view){app.selectRegion.show(new SelectorView({model:view.model,collection:app.channel.request("canvas:elements"),view:view}))},resetGuide:function(){guide.reset();app.selectRegion.empty()},getSelectedElement:function(){var select=app.selectRegion.currentView;return select?select.model:null}};this.listenTo(app.channel,"canvas:guide",api.positionGuide);this.listenTo(app.channel,"canvas:select",api.selectElement);this.listenTo(app.channel,"canvas:reset",api.resetGuide);this.listenTo(app.channel,"element:refresh:template",api.resetGuide);app.channel.reply("canvas:element:selected",api.getSelectedElement);app.channel.trigger("module:tools:ready",this)}});module.exports=ToolsModule},{"./show/guide":42,"./show/select-menu":44}],46:[function(require,module,exports){require("./preview/helpers");require("./preview/behaviors");require("./preview/css")},{"./preview/behaviors":47,"./preview/css":48,"./preview/helpers":49}],47:[function(require,module,exports){(function($,app,SettingAPI,ElementAPI){ElementAPI.onRender("tailor_carousel",function(atts,model){var carousel=this;var options={autoplay:"1"==atts.autoplay,arrows:"1"==atts.arrows,dots:false,fade:"1"==atts.fade&&"1"==atts.items_per_row,slidesToShow:parseInt(atts.items_per_row,10)||1,adaptiveHeight:true};carousel.$el.tailorCarousel(options)});ElementAPI.onRender("tailor_content",function(atts,model){if(this.$el.find(".is-lightbox-image").length>0){this.$el.tailorLightbox({disableOn:function(){return $el.hasClass("is-selected")}})}});ElementAPI.onRender("tailor_gallery",function(atts,model){var $el=this.$el;var options;if("carousel"==atts.layout){options={autoplay:"1"==atts.autoplay,arrows:"1"==atts.arrows,dots:"1"==atts.dots,fade:"1"==atts.fade&&"1"==atts.items_per_row,infinite:false,slidesToShow:parseInt(atts.items_per_row,10)||2};$el.tailorSimpleCarousel(options)}else if("slideshow"==atts.layout){options={autoplay:"1"==atts.autoplay,arrows:"1"==atts.arrows,dots:false,fade:true,items:".tailor-slideshow__slide",adaptiveHeight:true,draggable:false,speed:250};if("1"==atts.thumbnails){options.customPaging=function(slider,i){var thumb=$(slider.$slides[i]).data("thumb");return''};options.dots=true}$el.tailorSlideshow(options)}else if(atts.masonry){$el.tailorMasonry()}if(this.el.classList.contains("is-lightbox-gallery")){$el.tailorLightbox({disableOn:function(){return $el.hasClass("is-selected")}})}});ElementAPI.onRender("tailor_map",function(atts,model){this.$el.tailorGoogleMap()});ElementAPI.onRender("tailor_posts",function(atts,model){var $el=this.$el;var options;if("carousel"==atts.layout){options={autoplay:"1"==atts.autoplay,arrows:"1"==atts.arrows,dots:"1"==atts.dots,fade:"1"==atts.fade&&"1"==atts.items_per_row,infinite:false,slidesToShow:parseInt(atts.items_per_row,10)||2};this.$el.tailorSimpleCarousel(options)}else if(atts.masonry){$el.tailorMasonry()}});ElementAPI.onRender("tailor_section",function(atts,model){if(atts["background_image"]&&atts["parallax"]&&1==atts["parallax"]){this.$el.tailorParallax()}});ElementAPI.onRender("tailor_tabs",function(atts,model){this.$el.tailorTabs()});ElementAPI.onRender("tailor_toggles",function(atts,model){this.$el.tailorToggles()})})(window.jQuery,window.app,window.Tailor.Api.Setting,window.Tailor.Api.Element)},{}],48:[function(require,module,exports){var $=Backbone.$,$win=$(window);(function(window,app,SettingAPI){var cssRules=window._pageRules||[];var cssCollection={_tailor_section_width:"",_tailor_column_spacing:"",_tailor_element_spacing:"",_tailor_page_css:""};var stylesheet=document.createElement("style");stylesheet.appendChild(document.createTextNode(""));stylesheet.setAttribute("media","screen");stylesheet.setAttribute("id","tailor-settings");document.head.appendChild(stylesheet);function getStyleValues(string){var values;if(-1!=string.indexOf(",")){values=string.split(",")}else{values=string.split("-")}if(2==values.length){values=_.object(["top","bottom"],values)}else if(4==values.length){values=_.object(["top","right","bottom","left"],values)}else{values={}}return values}function getMediaQuery(string){var query="";_.each(["_tablet","_mobile"],function(target){if(string.substring(string.length-target.length)==target){query=target.substring(1)}});return query}function generateCSS(settingId,value){cssCollection[settingId]="";value=_.isString(value)?value.trim():value;if(!_.isEmpty(value)){_.each(cssRules[settingId],function(rule){var selectors=Tailor.CSS.parseSelectors(rule.selectors);var declarations=Tailor.CSS.parseDeclarations(rule.declarations).replace(/\{\{(.*?)\}\}/g,value);cssCollection[settingId]+="\n"+selectors+" {"+declarations+"}"})}}function updateStylesheet(){var value="";for(var settingId in cssCollection){if(cssCollection.hasOwnProperty(settingId)){value+=cssCollection[settingId]}}stylesheet.innerHTML=value;$win.trigger("resize")}app.channel.on("module:css:stylesheets:ready",function(cssModule){var settings=app.channel.request("sidebar:settings");if(settings&&settings.length){settings.each(function(setting){var id=setting.get("id");var value=setting.get("value");value=_.isString(value)?value.trim():value;if(!_.isEmpty(value)&&cssCollection.hasOwnProperty(id)){if(cssRules.hasOwnProperty(id)){generateCSS(id,value)}else{cssCollection[id]=value}}})}updateStylesheet();var ids=["_tailor_section_width","_tailor_column_spacing","_tailor_element_spacing"];_.each(ids,function(settingId){if(cssRules.hasOwnProperty(settingId)){SettingAPI.onChange("sidebar:"+settingId,function(to,from){generateCSS(settingId,to);updateStylesheet()})}});SettingAPI.onChange("sidebar:_tailor_page_css",function(to,from){cssCollection["_tailor_page_css"]=to;updateStylesheet()});SettingAPI.onChange("sidebar:_post_title",function(to,from){$("h1, h2, h1 a, h2 a").each(function(){if(from==this.textContent){this.textContent=to}})});window.Tailor.Settings.overrides={"*":{},tailor_button:{color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"color","tailorValidateColor"],background_color:[[".tailor-button__inner"],"background-color","tailorValidateColor"],background_color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"background-color","tailorValidateColor"],border_color:[[".tailor-button__inner"],"border-color","tailorValidateColor"],border_color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"border-color","tailorValidateColor"],padding:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],padding_tablet:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],padding_mobile:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],margin:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],margin_tablet:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],margin_mobile:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],border_width:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_radius:[[".tailor-button__inner"],"border-radius","tailorValidateUnit"],shadow:[[".tailor-button__inner"],"box-shadow"]},tailor_card:{border_color:[["",".tailor-card__header"],"border-color","tailorValidateColor"],padding:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"],padding_tablet:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"],padding_mobile:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"]},tailor_carousel:{border_color:[["",".slick-dots"],"border-color","tailorValidateColor"]},tailor_grid:{border_color:[[".tailor-grid__item"],"border-color","tailorValidateColor"],border_style:function(to,from,model){return[{selectors:["&.tailor-grid--bordered .tailor-grid__item"],declarations:{"border-style":tailorValidateString(to)+"!important"}}]},border_width:function(to,from,model){return[{selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]},border_width_tablet:function(to,from,model){return[{media:"tablet",selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]},border_width_mobile:function(to,from,model){return[{media:"mobile",selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]}},tailor_grid_item:{padding:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"],padding_tablet:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"],padding_mobile:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"]},tailor_tabs:{border_color:[[".tailor-tabs__navigation-item",".tailor-tab"],"border-color","tailorValidateColor"]},tailor_tab:{background_color:[["&.tailor-tabs__navigation-item","&.tailor-tab"],"background-color","tailorValidateColor"],padding:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],padding_tablet:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],padding_mobile:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],border_width:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],background_repeat:[["&.tailor-tab"],"background-repeat","tailorValidateString"],background_position:[["&.tailor-tab"],"background-position","tailorValidateString"],background_size:[["&.tailor-tab"],"background-size","tailorValidateString"],background_attachment:[["&.tailor-tab"],"background-attachment","tailorValidateString"]},tailor_toggle:{border_color:[[".tailor-toggle__title",".tailor-toggle__body"],"border-color","tailorValidateColor"],border_style:[[".tailor-toggle__title",".tailor-toggle__body"],"border-style","tailorValidateString"],border_radius:[[".tailor-toggle__title",".tailor-toggle__body"],"border-radius","tailorValidateUnit"]},tailor_section:{max_width:[[".tailor-section__content"],"max-width","tailorValidateUnit"],max_width_tablet:[[".tailor-section__content"],"max-width","tailorValidateUnit"],max_width_mobile:[[".tailor-section__content"],"max-width","tailorValidateUnit"],min_height:[[".tailor-section__content"],"min-height","tailorValidateUnit"],min_height_tablet:[[".tailor-section__content"],"min-height","tailorValidateUnit"],min_height_mobile:[[".tailor-section__content"],"min-height","tailorValidateUnit"]}};function getDefinition(tag,id,definition){if(window.Tailor.Settings.overrides["*"].hasOwnProperty(id)){return window.Tailor.Settings.overrides["*"][id]}if(window.Tailor.Settings.overrides.hasOwnProperty(tag)&&window.Tailor.Settings.overrides[tag].hasOwnProperty(id)){return window.Tailor.Settings.overrides[tag][id]}return definition}function registerCallbacks(definitions){_.each(definitions,function(definition,id){SettingAPI.onChange("element:"+id,function(to,from,model){definition=getDefinition(model.get("tag"),id,definition);if("function"==typeof definition){return definition.call(this,to,from,model)}if(""==to){return[]}var rule={media:getMediaQuery(id),selectors:definition[0],declarations:{}};if("function"==typeof window[definition[2]]){rule.declarations[definition[1]]=window[definition[2]](to)}else{rule.declarations[definition[1]]=to}return[rule]})})}_.each(["horizontal_alignment","horizontal_alignment_tablet","horizontal_alignment_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){var media=getMediaQuery(id);if(""!=media){media="-"+media}if(from){this.el.classList.remove("u-text-"+from+media)}this.el.classList.add("u-text-"+to+media);if("tailor_list_item"==model.get("tag")){var atts=model.get("atts");if(!_.isEmpty(atts["graphic_background_color"])||!_.isEmpty(atts["graphic_background_color_hover"])){return[{selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==to?"0":"1em","padding-right":"right"==to?"1em":"0"}}]}else{return[{selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}}]}}})});_.each(["vertical_alignment","vertical_alignment_tablet","vertical_alignment_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){var media=getMediaQuery(id);if(""!==media){media="-"+media}if(from){this.el.classList.remove("u-align-"+from+media)}this.el.classList.add("u-align-"+to+media)})});_.each(["size","size_tablet","size_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){if("tailor_button"==model.get("tag")){var media=getMediaQuery(id);if(""!=media){media="-"+media}if(from){this.el.classList.remove("tailor-button--"+from+media)}this.el.classList.add("tailor-button--"+to+media)}})});registerCallbacks({width:[[],"width","tailorValidateUnit"],width_tablet:[[],"width","tailorValidateUnit"],width_mobile:[[],"width","tailorValidateUnit"],max_width:[[],"max-width","tailorValidateUnit"],max_width_tablet:[[],"max-width","tailorValidateUnit"],max_width_mobile:[[],"max-width","tailorValidateUnit"],min_height:[[],"min-height","tailorValidateUnit"],min_height_tablet:[[],"min-height","tailorValidateUnit"],min_height_mobile:[[],"min-height","tailorValidateUnit"],min_item_height:[[".tailor-grid__item"],"min-height","tailorValidateUnit"]});registerCallbacks({color:[[],"color","tailorValidateColor"],color_hover:[[":hover"],"color","tailorValidateColor"], -link_color:[["a"],"color","tailorValidateColor"],link_color_hover:[["a:hover"],"color","tailorValidateColor"],heading_color:[["h1","h2","h3","h4","h5","h6"],"color","tailorValidateColor"],background_color:function(to,from,model){var atts=model.get("atts");if(atts["background_image"]){return false}var definition=getDefinition(model.get("tag"),"background_color",[[],"background-color","tailorValidateColor"]);if("function"==typeof definition){return definition.call(this,to,from,model)}var rule={selectors:definition[0],declarations:{}};if("function"==typeof window[definition[2]]){rule.declarations[definition[1]]=window[definition[2]](to)}else{rule.declarations[definition[1]]=to}return[rule]},background_color_hover:[[":hover"],"background-color","tailorValidateColor"],border_color:[[],"border-color","tailorValidateColor"],border_color_hover:[[":hover"],"border-color","tailorValidateColor"],graphic_color:function(to,from,model){var tag=model.get("tag");if("tailor_box"==tag){return[{selectors:[".tailor-box__graphic"],declarations:{color:tailorValidateColor(to)}}]}else if("tailor_list_item"==tag){return[{selectors:[".tailor-list__graphic"],declarations:{color:tailorValidateColor(to)}}]}},graphic_color_hover:function(to,from,model){var tag=model.get("tag");if("tailor_box"==tag){return[{selectors:[".tailor-box__graphic:hover"],declarations:{color:tailorValidateColor(to)}}]}else if("tailor_list_item"==tag){return[{selectors:[".tailor-list__graphic:hover"],declarations:{color:tailorValidateColor(to)}}]}},graphic_background_color:function(to,from,model){var tag=model.get("tag");var rules=[];if("tailor_box"==tag){if(to){rules.push({selectors:[".tailor-box__graphic"],declarations:{"margin-bottom":"1em","background-color":tailorValidateColor(to),"text-align":"center"}})}}else if("tailor_list_item"==tag){var atts=model.get("atts");var alignment=atts["horizontal_alignment"];if(to){rules.push({selectors:[".tailor-list__graphic"],declarations:{"background-color":tailorValidateColor(to),"text-align":"center"}});rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{if(!_.isEmpty(atts["graphic_background_color_hover"])){rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}})}}}return rules},graphic_background_color_hover:function(to,from,model){var tag=model.get("tag");var rules=[];if("tailor_box"==tag){if(to){rules.push({selectors:[".tailor-box__graphic"],declarations:{"margin-bottom":"1em","text-align":"center"}});rules.push({selectors:[".tailor-box__graphic:hover"],declarations:{"background-color":tailorValidateColor(to)}})}}else if("tailor_list_item"==tag){var atts=model.get("atts");var alignment=atts["horizontal_alignment"];if(to){rules.push({selectors:[".tailor-list__graphic"],declarations:{"text-align":"center"}});rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}});rules.push({selectors:[".tailor-list__graphic:hover"],declarations:{"background-color":tailorValidateColor(to)}})}else{if(!_.isEmpty(atts["graphic_background_color"])){rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}})}}}return rules},title_color:[[".tailor-toggle__title"],"color","tailorValidateColor"],title_background_color:[[".tailor-toggle__title"],"background-color","tailorValidateColor"],navigation_color:function(to,from,model){return[{selectors:[".slick-active button:before"],declarations:{"background-color":tailorValidateColor(to)}},{selectors:[".slick-arrow:not( .slick-disabled )"],declarations:{color:tailorValidateColor(to)}}]}});registerCallbacks({"class":function(to,from,model){var classNames;if(!_.isEmpty(from)){classNames=from.trim().split(/\s+(?!$)/g);for(var i in classNames){if(classNames.hasOwnProperty(i)){this.el.classList.remove(classNames[i])}}}if(!_.isEmpty(to)){classNames=to.trim().split(/\s+(?!$)/g);for(var j in classNames){if(classNames.hasOwnProperty(j)){this.el.classList.add(classNames[j])}}}},border_style:[[],"border-style","tailorValidateString"],border_radius:[[],"border-radius","tailorValidateUnit"],background_repeat:[[],"background-repeat","tailorValidateString"],background_position:[[],"background-position","tailorValidateString"],background_size:[[],"background-size","tailorValidateString"],background_attachment:[[],"background-attachment","tailorValidateString"],shadow:function(to,from,model){var definition=getDefinition(model.get("tag"),"shadow",[[]]);if("function"==typeof definition){return definition.call(this,to,from,model)}if(1==to){return[{selectors:definition[0],declarations:{"box-shadow":"0 2px 6px rgba(0, 0, 0, 0.1)"}}]}return[]}});_.each({margin:[[],"margin-{0}","tailorValidateUnit"],margin_tablet:[[],"margin-{0}","tailorValidateUnit"],margin_mobile:[[],"margin-{0}","tailorValidateUnit"],padding:[[],"padding-{0}","tailorValidateUnit"],padding_tablet:[[],"padding-{0}","tailorValidateUnit"],padding_mobile:[[],"padding-{0}","tailorValidateUnit"],border_width:[[],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[[],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[[],"border-{0}-width","tailorValidateUnit"]},function(definition,id){SettingAPI.onChange("element:"+id,function(to,from,model){definition=getDefinition(model.get("tag"),id,definition);if("function"==typeof definition){return definition.call(this,to,from,model)}var rules=[];var rule={media:getMediaQuery(id),selectors:definition[0],declarations:{}};_.each(getStyleValues(to),function(value,position){if("function"==typeof window[definition[3]]){rule.declarations[definition[1].replace("{0}",position)]=window[definition[2]](value)}else{rule.declarations[definition[1].replace("{0}",position)]=value}});if(_.keys(rule.declarations).length>0){rules.push(rule)}return rules})})})})(window,window.app,window.Tailor.Api.Setting)},{}],49:[function(require,module,exports){window.tailorValidateString=function(string){return string.replace(/[0-9]/g,"")};window.tailorValidateNumber=function(string){string=string.replace(/[^0-9,.]+/i,"");return!_.isEmpty(string)?string:"0"};window.tailorValidateColor=function(color){if(/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(color)){return color}if(isRGBA(color)){return color}return""};function isRGBA(color){return/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d*(?:\.\d+)?)\)$/.test(color)}window.tailorValidateUnit=function(value){var sign="";if("-"==value.charAt(0)){sign="-";value=value.substring(1)}return sign+tailorValidateNumber(value)+getUnit(value)};function getUnit(string){var map=["px","%","in","cm","mm","pt","pc","em","rem","ex","vw","vh"];var matches=string.match(new RegExp(map.join("|")));if(matches){return matches[0]}return"px"}},{}],50:[function(require,module,exports){var $=window.jQuery,$win=$(window),app=window.app,cssModule,callbacks={sidebar:[],element:[]};function checkQuery(query){if(!query||!_.contains(_.keys(cssModule.stylesheets),query)){query="all"}return query}var onSidebarChange=function(setting){var settingId=setting.get("id");if(_.isEmpty(callbacks["sidebar"][settingId])){return}_.each(callbacks["sidebar"][settingId],function(callback){callback.apply(window,[setting.get("value"),setting.previous("value")])});$win.trigger("resize")};var onElementChange=function(setting,view){var elementId=view.model.get("id");var settingId=setting.get("id");if(!callbacks["element"].hasOwnProperty(settingId)||0==callbacks["element"][settingId].length){return}if(1==callbacks["element"][settingId].length){cssModule.deleteRules(elementId,settingId)}var ruleSets={};var rules;_.each(callbacks["element"][settingId],function(callback){if("function"==typeof callback){rules=callback.apply(view,[setting.get("value"),setting.previous("value"),view.model]);if(false===rules){view.model.trigger("change:atts",view.model,view.model.get("atts"))}else if(_.isArray(rules)&&rules.length>0){for(var rule in rules){if(rules.hasOwnProperty(rule)){if(!rules[rule].hasOwnProperty("selectors")||!rules[rule].hasOwnProperty("declarations")){continue}var query=checkQuery(rules[rule].media);ruleSets[query]=ruleSets[query]||{};ruleSets[query][elementId]=ruleSets[query][elementId]||[];if(_.keys(rules[rule].declarations).length>0){ruleSets[query][elementId].push({selectors:rules[rule].selectors,declarations:rules[rule].declarations,setting:rules[rule].setting||settingId})}}}cssModule.addRules(ruleSets)}}})};app.listenTo(app.channel,"sidebar:setting:change",onSidebarChange);app.listenTo(app.channel,"element:setting:change",onElementChange);app.channel.on("module:css:stylesheets:ready",function(module){cssModule=module});function registerCallback(type,id,callback){if("function"===typeof callback){callbacks[type][id]=callbacks[type][id]||[];callbacks[type][id].push(callback)}}module.exports={onChange:function(id,callback){var parts=id.split(":");if(parts.length>=2&&_.contains(["sidebar","element"],parts[0])){registerCallback(parts[0],parts[1],callback)}}}},{}],51:[function(require,module,exports){var DraggableBehaviors=Marionette.Behavior.extend({events:{dragstart:"onDragStart",dragend:"onDragEnd",drag:"onDrag"},onDragStart:function(e){app.channel.trigger("canvas:dragstart",e.originalEvent,this.view)},onDrag:function(e){app.channel.trigger("canvas:drag",e.originalEvent,this.view)},onDragEnd:function(e){app.channel.trigger("canvas:dragend",e.originalEvent,this.view)}});module.exports=DraggableBehaviors},{}],52:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],53:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],54:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],55:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],56:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],58:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],59:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},onInitialize:function(){this.querySelectors();var initial=this.options.initial-1;if(initial>=0&&this.$toggles.length>initial){this.activate(this.$toggles[initial])}},querySelectors:function(){this.$content=this.$el.find(this.options.content).hide();this.$toggles=this.$el.find(this.options.toggles).off().on("click",$.proxy(this.onClick,this))},activate:function(el){var speed=this.options.speed;var $el=$(el);if(this.options.accordion){this.$toggles.filter(function(){return this!==el}).removeClass("is-active");this.$content.each(function(){var $toggle=$(this);if(el.nextElementSibling==this){$toggle.slideToggle(speed)}else{$toggle.slideUp(speed)}})}else{this.$content.filter(function(){return el.nextElementSibling==this}).slideToggle(speed)}$el.toggleClass("is-active");$win.trigger("resize")},onClick:function(e){this.activate(e.target);e.preventDefault()},onDestroy:function(e){this.$toggles.off()},onChangeChild:function(){this.querySelectors()}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],60:[function(require,module,exports){var $=jQuery,Ajax;Ajax={url:window.ajaxurl,post:function(action,data){return ajax.send({data:_.isObject(action)?action:_.extend(data||{},{action:action})})},send:function(action,options){if(_.isObject(action)){options=action}else{options=options||{};options.data=_.extend(options.data||{},{action:action,tailor:1})}options=_.defaults(options||{},{type:"POST",url:ajax.url,context:this});return $.Deferred(function(deferred){if(options.success){deferred.done(options.success)}var onError=options.error?options.error:ajax.onError;deferred.fail(onError);delete options.success;delete options.error;$.ajax(options).done(function(response){if(response==="1"||response===1){response={success:true}}if(_.isObject(response)&&!_.isUndefined(response.success)){deferred[response.success?"resolveWith":"rejectWith"](this,[response.data])}else{deferred.rejectWith(this,[response])}}).fail(function(){deferred.rejectWith(this,arguments)})}).promise()},onError:function(response){if(!Tailor.Notify){console.error(response);return}if(response&&response.hasOwnProperty("message")){Tailor.Notify(response.message)}else if("0"==response){Tailor.Notify(window._l10n.expired)}else if("-1"==response){Tailor.Notify(window._l10n.invalid)}else{Tailor.Notify(window._l10n.error)}}};window.ajax=Ajax;module.exports=Ajax},{}],61:[function(require,module,exports){var CSS={addRule:function(sheet,selector,declaration,index){if("insertRule"in sheet){sheet.insertRule(selector+" {"+declaration+"}",sheet.cssRules.length); - -}else if("addRule"in sheet){sheet.addRule(selector,declaration,sheet.cssRules.length)}},deleteRule:function(sheet,index){if("deleteRule"in sheet){sheet.deleteRule(index)}else if("removeRule"in sheet){sheet.removeRule(index)}},parseSelectors:function(selectors,elementId){if(_.isString(selectors)){return selectors}var elementClass=elementId?".tailor-"+elementId:"";var prefix=".tailor-ui ";if(!selectors.length){return prefix+elementClass}selectors=selectors.map(function(selector){if(selector.indexOf("&")>-1){selector=selector.replace("&",elementClass)}else{var firstCharacter=selector.charAt(0);if(":"==firstCharacter||"::"==firstCharacter){selector=elementClass+selector}else{selector=elementClass+" "+selector}}return prefix+selector});return selectors.join(",")},parseDeclarations:function(declarations){if(_.isString(declarations)){return declarations}var declaration="";_.each(declarations,function(value,property){declaration+=property+":"+value+";"});return declaration}};module.exports=CSS},{}],62:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;iThe template for '+view.cid+" could not be refreshed

");console.log(response)},complete:function(){var isEditing=view.$el.hasClass("is-editing");var isSelected=view.$el.hasClass("is-selected");view.$el.removeClass("is-rendering");view.triggerAll("before:element:refresh",view,model.atts);view.render();view.triggerAll("element:refresh",view,model.atts);if(isEditing){view.$el.addClass("is-editing")}if(isSelected){view.$el.addClass("is-selected")}}})},500),onChangeSetting:function(setting,refresh){if(refresh){this.triggerAll("before:element:jsRefresh",this,this.model.get("atts"));app.channel.trigger("element:setting:change",setting,this);this.triggerAll("element:jsRefresh",this,this.model.get("atts"))}},onChangeParent:function(){this.triggerAll("element:change:parent",this)},onBeforeRender:function(){this.triggerAll("before:element:ready",this)},onDomRefresh:function(){var view=this;this.$el.find("a").attr({draggable:false,target:"_blank"});this.$el.find("[onchange]").removeAttr("onchange");this.$el.find("img").attr({draggable:false});this.$el.imagesLoaded(function(){view._isReady=true;if(view.el.classList.contains("tailor-widget")&&0==view.$el.children().innerHeight()){var el=document.querySelector("#tmpl-tailor-element-empty");if(el){view.$el.html(el.innerHTML)}}view.triggerAll("element:ready",view)})},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this)},onDestroy:function(){this.triggerAll("element:destroy",this)},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}}});module.exports=ElementView},{}],19:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Carousel;Carousel=Components.create({slickActive:false,getDefaults:function(){return{items:".tailor-carousel__item",prevArrow:'',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:true,fade:false}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.slick()},slick:function(){var component=this;component.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){this.$wrap.slick("refresh")},unSlick:function(){this.$wrap.slick("unslick")},onMove:function(){if(this.slickActive){this.refreshSlick()}},onBeforeCopy:function(){if(this.slickActive){this.unSlick()}},onCopy:function(){if(!this.slickActive){this.slick()}},onBeforeRefresh:function(){if(this.slickActive){this.unSlick()}},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){if(this.slickActive){this.unSlick()}},onResize:function(){if(this.slickActive){this.refreshSlick()}}});$.fn.tailorSimpleCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSimpleCarousel");if(!instance){$.data(this,"tailorSimpleCarousel",new Carousel(this,options,callbacks))}})}},{}],20:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Carousel;Carousel=Components.create({getDefaults:function(){return{items:".tailor-carousel__item",prevArrow:'',nextArrow:'',adaptiveHeight:false,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,initialSlide:0,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:false,infinite:false}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.slickAt(0,this.addEventListeners)},slickAt:function(index,callback){this.querySelectors();var numberItems=this.$items.length;if(!numberItems){return}index=Math.min(index,numberItems-1);if(index "+component.options.items);component.$dots=component.$el.children(".slick-dots").find(" > li");component.$dots.on("click",function(e){var $dot=$(e.currentTarget);component.currentSlide=$dot.data("id");component.$wrap.slick("slickGoTo",$dot.index());e.preventDefault()});if(!component.currentSlide){var $activeSlide=component.$items.filter(function(){return this.classList.contains("slick-current")});component.currentSlide=$activeSlide.length?$activeSlide.id:component.$items[0].id}},updateDots:function(index){this.$dots.each(function(i,el){if(index==i){el.classList.add("slick-active")}else{el.classList.remove("slick-active")}});this.$dots.toggle(this.$dots.length/this.options.slidesToShow>1)},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onBeforeRefresh:function(){this.unSlick()},onRefresh:function(){this.refreshSlick()},onJSRefresh:function(){this.refreshSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onAddChild:function(){this.refreshSlick()},onRemoveChild:function(e,childView){childView.$el.detach();this.refreshSlick()},onBeforeReadyChild:function(e,childView){this.unSlick()},onReadyChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeReorderChild:function(){this.unSlick()},onReorderChild:function(e,cid,index,oldIndex){this.querySelectors();this.slickAt(index)},onBeforeRefreshChild:function(){this.unSlick()},onRefreshChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeJSRefreshChild:function(){this.unSlick()},onJSRefreshChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeDestroyChild:function(){this.unSlick()},onDestroyChild:function(e,childView){var index=childView.$el.index();childView.$el.remove();this.slickAt(index)},onAddDescendant:function(){this.refreshSlick()},onRemoveDescendant:function(){this.refreshSlick()},onReadyDescendant:function(){this.refreshSlick()},onRefreshDescendant:function(){this.refreshSlick()},onJSRefreshDescendant:function(){this.refreshSlick()},onDestroyDescendant:function(){this.refreshSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorCarousel");if(!instance){$.data(this,"tailorCarousel",new Carousel(this,options,callbacks))}})}},{}],21:[function(require,module,exports){var ElementCollection=Backbone.Collection.extend({comparator:"order",model:function(attrs,options){var Model=Tailor.lookup(attrs.tag,attrs.type,"Models");return new Model(attrs,options)},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"change:parent",this.onChangeParent);this.listenTo(this,"add",this.onAdd);this.listenTo(this,"destroy",this.onDestroy);this.listenTo(this,"container:collapse",this.onCollapse);this.listenTo(this,"reset",this.onReset)},getElementDefinitions:function(){return this.library||app.channel.request("sidebar:library")},applyDefaults:function(model){if(model instanceof Backbone.Model){model=model.toJSON()}var item=this.getElementDefinitions().findWhere({tag:model.tag});var defaults={label:item.get("label"),type:item.get("type")};var child=item.get("child");if(child){defaults.child=child}var childViewContainer=item.get("child_container");if(childViewContainer){defaults.child_container=childViewContainer}model.atts=model.atts||{};_.each(item.get("settings"),function(setting){if(!_.isEmpty(setting["value"])&&!model.atts.hasOwnProperty(setting["id"])){model.atts[setting["id"]]=setting["value"]}});return _.extend(model,defaults)},getParent:function(model){return this.findWhere({id:model.get("parent")})},getChildren:function(model){return this.where({parent:model.get("id")})},getSiblings:function(model){return this.where({parent:model.get("parent")})},hasSelectedParent:function(model){var selected=app.channel.request("canvas:element:selected");if(!selected||model===selected){return false}var parentId=model.get("parent");var parent=this.findWhere({id:parentId});while("undefined"!==typeof parent){if(selected===parent){return true}parentId=parent.get("parent");parent=this.get(parentId)}return false},onChangeParent:function(model){var parent=this.get(model.get("parent"));var previousParent=this.get(model.previous("parent"));this.sort({silent:true});this._checkParent(previousParent);if("tailor_column"===model.get("tag")){this._reBalanceColumns(parent);this._reBalanceColumns(previousParent)}},onAdd:function(model,collection,options){if("tailor_column"==model.get("tag")){this._reBalanceColumns(this.get(model.get("parent")))}},onDestroy:function(model){var parent=this.get(model.get("parent"));this._checkParent(parent);var children=this.where({parent:model.get("id")});if(children.length){_.each(children,function(child){child.trigger("destroy",child,this)},this)}if(parent&&"tailor_column"===model.get("tag")){this._reBalanceColumns(parent)}if(0===this.length){this.onEmpty()}},onReset:function(){if(0===this.length){this.onEmpty()}},onEmpty:function(){var section=this.createSection(0);this.create([{tag:"tailor_content",atts:{},parent:section.get("id"),order:0}])},onCollapse:function(model,children){var parentId=model.get("parent");_.each(children,function(child){child.set("parent",parentId)},this)},add:function(models,options){if(_.isArray(models)){_.each(models,this.applyDefaults.bind(this))}else{this.applyDefaults(models)}return this.set(models,_.extend({merge:false},options,{add:true,remove:false}))},create:function(models,options){options=options||{};return this.add(models,options)},createSection:function(order){return _.first(this.create([{tag:"tailor_section",order:order}],{at:order}))},createRow:function(parentId,order){var row=_.first(this.create([{tag:"tailor_row",parent:parentId,order:order}],{}));return this.create([{tag:"tailor_column",atts:{width:"50%"},parent:row.get("id"),order:0},{tag:"tailor_column",atts:{width:"50%"},parent:row.get("id"),order:1}])},createColumn:function(parentId,order){return _.first(this.create([{tag:"tailor_column",parent:parentId,order:order}]))},createContainer:function(model,parentId,order,descendants){var tag=model.get("tag");var container=_.first(this.create([{tag:tag,parent:parentId,order:order}],{at:order,silent:true}));var childTag=model.get("child");var children=this.create([{tag:childTag,parent:container.get("id"),order:0},{tag:childTag,parent:container.get("id"),order:1}],{silent:true});if(descendants){_.first(descendants).set("parent",_.first(children).get("id"),{silent:true});_.last(descendants).set("parent",_.last(children).get("id"),{silent:true})}this.trigger("add",container,this,{})},createWrapper:function(tag,parentId,order,child){var wrapper=_.first(this.create([{tag:tag,parent:parentId,order:order}],{silent:true}));if("undefined"==typeof child){this.create([{tag:"tailor_content",parent:wrapper.get("id"),order:0}],{silent:true})}this.trigger("add",wrapper,this,{});if("undefined"!=typeof child){this.insertChild(child,wrapper)}return wrapper},createChild:function(model){var child=_.first(this.create([{tag:model.get("child"),parent:model.get("id"),order:this.getChildren(model).length}],{silent:true}));this.create([{tag:"tailor_content",parent:child.get("id"),order:0}],{silent:true});this.trigger("add",child,this,{});return child},insertChild:function(child,parent){if(!child){return}if(child.get("parent")!==parent.get("id")){child.trigger("remove:child")}parent.trigger("insert",child);child.trigger("add:child");child.set("parent",parent.get("id"))},_reBalanceColumns:function(model){var children=this.where({parent:model.get("id")});var numberChildren=children.length;_.each(children,function(child){var atts=_.clone(child.get("atts"));atts["width"]=Math.round(parseFloat(1/numberChildren)*1e3)/10+"%";delete atts["width_tablet"];delete atts["width_mobile"];child.set("atts",atts,{silent:true});child.trigger("change:width",child,atts)},this)},_checkParent:function(model){if(!model){return}if("container"==model.get("type")){this._checkCollapsibleContainer(model)}this._checkChildren(model)},_checkChildren:function(model){var children=this.where({parent:model.get("id")});if(0===children.length){model.trigger("destroy",model)}},_checkCollapsibleContainer:function(model){var childTag=this.getElementDefinitions().findWhere({tag:model.get("tag")}).get("child");var containerId=model.get("id");var children=this.filter(function(element){return containerId===element.get("parent")&&childTag===element.get("tag")});if(0===children.length){model.trigger("container:collapse",model,this.where({parent:containerId}))}else if(1===children.length){var child=_.first(children);if("tailor_row"===model.get("tag")){child.trigger("container:collapse",child,this.where({parent:child.get("id")}))}}}});module.exports=ElementCollection},{}],22:[function(require,module,exports){var ChildModel=require("./../element-child"),ColumnModel;ColumnModel=ChildModel.extend({validTarget:function(that,region){if(_.contains(["tailor_section","tailor_row"],that.get("tag"))||!_.contains(["left","right"],region)){return false}if("child"==that.get("type")&&that.get("tag")!=this.get("tag")){return false}var siblings=this.collection.getSiblings(this);return that.get("parent")==this.get("parent")||siblings.length<6}});module.exports=ColumnModel},{"./../element-child":28}],23:[function(require,module,exports){var ChildModel=require("./../element-child"),GridItemModel;GridItemModel=ChildModel.extend({validTarget:function(that,region){if("tailor_section"==that.get("tag")||_.contains(["top","bottom","center"],region)){return false}var parent=this.collection.getParent(this);if(parent.get("tag")==that.get("tag")){return false}return that.get("tag")==this.get("tag")}});module.exports=GridItemModel},{"./../element-child":28}],24:[function(require,module,exports){var ContainerModel=require("./../element-container"),CarouselModel;CarouselModel=ContainerModel.extend({createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();var $navigation=view.$el.find(".slick-dots").detach();this.appendTemplate(id,view);$childViewContainer.append($children);$navigation.insertAfter($childViewContainer);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=CarouselModel},{"./../element-container":30}],25:[function(require,module,exports){var ContainerModel=require("./../element-container"),RowModel;RowModel=ContainerModel.extend({validTarget:function(that,region){if("child"==that.get("type")||"tailor_section"==that.get("tag")||"center"==region){return false}return _.contains(["top","bottom"],region)&&"tailor_column"!=that.get("tag")}});module.exports=RowModel},{"./../element-container":30}],26:[function(require,module,exports){var ContainerModel=require("./../element-container"),TabsModel;TabsModel=ContainerModel.extend({createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();var $navigation=view.$el.find(".tailor-tabs__navigation");var $navigationItems=$navigation.children().detach();this.appendTemplate(id,view);$childViewContainer.append($children);$navigation.append($navigationItems);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=TabsModel},{"./../element-container":30}],27:[function(require,module,exports){var Model;Backbone.Model.prototype.set=_.wrap(Backbone.Model.prototype.set,function(oldSet,key,val,options){if(key==null)return this;var attrs;if(typeof key==="object"){attrs=key;options=val}else{(attrs={})[key]=val}options||(options={});var ret=oldSet.call(this,attrs,options);if(this._tracking){_.each(attrs,_.bind(function(val,key){if(_.isEqual(this._original[key],val)){delete this._unsaved[key]}else{this._unsaved[key]=val}},this))}return ret});Model=Backbone.Model.extend({_tracking:false,_original:{},_unsaved:{},defaults:function(){return{id:this.cid,tag:"",label:"",atts:{},parent:"",order:0,collection:"element"}},isTracking:function(){return this._tracking},startTracking:function(){this._tracking=true;this.resetTracking();return this},stopTracking:function(){this._tracking=false;this._original={};this._unsaved={};return this},resetTracking:function(){this._original=_.clone(this.attributes);this._unsaved={};return this},resetAttributes:function(){if(!this._tracking){return}this.attributes=this._original;this.resetTracking();this.trigger("change:atts",this,this.get("atts"));return this},toShortcode:function(){var tag=this.get("tag");var atts=this.get("atts");var content="";var shortcode="["+tag;_.each(atts,function(attr,id){if(attr){if("content"===id){content=attr}else{if(_.isNumber(id)){if(/\s/.test(attr)){shortcode+=' "'+attr+'"'}else{shortcode+=" "+attr}}else{shortcode+=" "+id+'="'+attr+'"'}}}},this);return shortcode+"]"+content+"[/"+tag+"]"},insertBefore:function(view){this.trigger("remove:child");this.trigger("insert:before",view);this.trigger("add:child");this.set("parent",view.model.get("parent"))},insertAfter:function(view){this.trigger("remove:child");this.trigger("insert:after",view);this.trigger("add:child");this.set("parent",view.model.get("parent"))},columnBefore:function(view){var model=view.model;var parent=model.get("parent");if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(parent,model.get("order")-1);this.collection.insertChild(this,column)}else{var columns=this.collection.createRow(parent,model.get("order"));this.collection.insertChild(this,_.first(columns));this.collection.insertChild(model,_.last(columns))}},columnAfter:function(view){var model=view.model;var parent=model.get("parent");if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(parent,model.get("order"));this.collection.insertChild(this,column)}else{var columns=this.collection.createRow(parent,model.get("order"));this.collection.insertChild(model,_.first(columns));this.collection.insertChild(this,_.last(columns))}},beforeCopyElement:function(view){var el=view.el;view.triggerAll("before:element:copy",view);el.classList.remove("is-dragging");el.classList.remove("is-hovering");el.classList.remove("is-selected");el.classList.remove("is-editing")},appendTemplate:function(id,view){var oldId=view.model.get("id");var template=document.createElement("script");template.setAttribute("type","text/html");template.id="tmpl-tailor-"+id;template.innerHTML=view.el.outerHTML.replace(oldId,id);document.body.appendChild(template)},afterCopyElement:function(id,view){var oldId=view.model.get("id");view.$el.trigger("element:copy",view);app.channel.trigger("css:copy",oldId,id)}});module.exports=Model},{}],28:[function(require,module,exports){var CompositeModel=require("./element-composite"),ChildModel;ChildModel=CompositeModel.extend({validTarget:function(that,region){if("tailor_section"==that.get("tag")||_.contains(["left","right","center"],region)){return false}var parent=this.collection.getParent(this);if(parent.get("tag")==that.get("tag")){return false}return that.get("tag")==this.get("tag")},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.insertBefore);this.listenTo(this,"element:move:right",this.insertAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyBefore);this.listenTo(this,"element:copy:right",this.copyAfter)}});module.exports=ChildModel},{"./element-composite":29}],29:[function(require,module,exports){var BaseModel=require("./element-base"),CompositeModel;CompositeModel=BaseModel.extend({cloneContainer:function(sourceView,parent,index){var collection=this.collection;var clone=sourceView.model.clone();clone.set("id",clone.cid);clone.set("parent",parent);clone.set("order",index);this.createTemplate(clone.cid,sourceView);var clonedChildren=this.cloneChildren(sourceView.children,clone,[]);collection.add(clonedChildren,{silent:true});collection.add(clone);sourceView.triggerMethod("element:refresh")},cloneChildren:function(childViews,parent,clones){if(childViews.length){childViews.each(function(childView){var clone=childView.model.clone();clone.set("id",clone.cid);clone.set("parent",parent.get("id"));clone.createTemplate(clone.cid,childView);clones.push(clone);if(childView.children){this.cloneChildren(childView.children,clone,clones)}},this)}return clones},copyBefore:function(targetView,sourceView){this.cloneContainer(sourceView,targetView.model.get("parent"),targetView.model.get("order")-1)},copyAfter:function(targetView,sourceView){this.cloneContainer(sourceView,targetView.model.get("parent"),targetView.model.get("order"))},copyColumnBefore:function(targetView,sourceView){var parent=targetView.model.get("parent");if("tailor_column"===targetView.model.get("tag")){var column=this.collection.createColumn(parent,targetView.model.get("order")-1);this.cloneContainer(sourceView,column.get("id"),0)}else{var columns=this.collection.createRow(parent,targetView.model.get("order"));this.collection.insertChild(targetView.model,_.last(columns));this.cloneContainer(sourceView,_.first(columns).get("id"),0)}},copyColumnAfter:function(targetView,sourceView){var parent=targetView.model.get("parent");if("tailor_column"===targetView.model.get("tag")){var column=this.collection.createColumn(parent,targetView.model.get("order"));this.cloneContainer(sourceView,column.get("id"),0)}else{var columns=this.collection.createRow(parent,targetView.model.get("order"));this.collection.insertChild(targetView.model,_.first(columns));this.cloneContainer(sourceView,_.last(columns).get("id"),0)}},createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();this.appendTemplate(id,view);$childViewContainer.append($children);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=CompositeModel},{"./element-base":27}],30:[function(require,module,exports){var CompositeModel=require("./element-composite"),ContainerModel;ContainerModel=CompositeModel.extend({validTarget:function(that,region){if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("center"==region){return"container"!=that.get("type")}if(_.contains(["wrapper","child"],parent.get("type"))){if(_.contains(["top","bottom"],region)){return _.contains(["tailor_section","tailor_column"],parent.get("tag"))||!_.contains(["container","wrapper","child"],that.get("type"))}return"tailor_section"==parent.get("tag")||!_.contains(["left","right"],region)}return"container"!=that.get("type")},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter)}});module.exports=ContainerModel},{"./element-composite":29}],31:[function(require,module,exports){var CompositeModel=require("./element-composite"),WrapperModel;WrapperModel=CompositeModel.extend({validTarget:function(that,region){if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))||"center"==region){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("child"==parent.get("type")&&"tailor_column"!=parent.get("tag")){return"container"!=that.get("type")&&!_.contains(["left","right"],region)}if(_.contains(["container","wrapper","child"],parent.get("type"))){return"tailor_section"==parent.get("tag")||!_.contains(["left","right"],region)}return true},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter);this.listenTo(this,"element:move:center",this.createChild);this.listenTo(this,"element:copy:center",this.copyChild)},createChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;this.createTemplate(sourceView.model.get("id"),sourceView);this.collection.createWrapper(childTag,id,numberChildren,sourceView.model)},copyChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;var wrapper=this.collection.createWrapper(childTag,id,numberChildren,false);this.cloneContainer(sourceView,wrapper.get("id"),0)}});module.exports=WrapperModel},{"./element-composite":29}],32:[function(require,module,exports){var BaseModel=require("./element-base"),ElementModel;ElementModel=BaseModel.extend({validTarget:function(that,region,threshold){if(threshold<20){return false}if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))||"center"==region){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("child"==parent.get("type")&&"tailor_column"!=parent.get("tag")){return"container"!=that.get("type")&&!_.contains(["left","right"],region)}if(_.contains(["wrapper","child"],parent.get("type"))){if(_.contains(["top","bottom"],region)){return _.contains(["tailor_section","tailor_column"],parent.get("tag"))||!_.contains(["container","wrapper","child"],that.get("type"))}return"tailor_section"==parent.get("tag")||_.contains(["left","right"],region)}return true},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter);this.listenTo(this,"element:move:center",this.createChild);this.listenTo(this,"element:copy:center",this.copyChild)},copyBefore:function(targetView,sourceView){var clone=sourceView.model.clone();var index=targetView.model.get("order")-1;clone.set("id",clone.cid);clone.set("parent",targetView.model.get("parent"));clone.set("order",index);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},copyAfter:function(targetView,sourceView){var clone=sourceView.model.clone();var index=targetView.model.get("order");clone.set("id",clone.cid);clone.set("parent",targetView.model.get("parent"));clone.set("order",index);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},copyColumnBefore:function(targetView,sourceView){var model=targetView.model;var clone=sourceView.model.clone();clone.set("id",clone.cid);this.createTemplate(clone.cid,sourceView);if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(model.get("parent"),model.get("order")-1);clone.set("parent",column.get("id"));this.collection.add(clone)}else{var columns=this.collection.createRow(model.get("parent"),model.get("order"));this.collection.insertChild(model,_.last(columns));clone.set("parent",_.first(columns).get("id"));this.collection.add(clone)}},copyColumnAfter:function(targetView,sourceView){var model=targetView.model;var clone=sourceView.model.clone(); +clone.set("id",clone.cid);this.createTemplate(clone.cid,sourceView);if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(model.get("parent"),model.get("order"));clone.set("parent",column.get("id"));this.collection.add(clone)}else{var columns=this.collection.createRow(model.get("parent"),model.get("order"));this.collection.insertChild(model,_.first(columns));clone.set("parent",_.last(columns).get("id"));this.collection.add(clone)}},createChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;this.appendTemplate(sourceView.model.get("id"),sourceView);this.collection.createWrapper(childTag,id,numberChildren,sourceView.model)},copyChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;var wrapper=this.collection.createWrapper(childTag,id,numberChildren,false);var clone=sourceView.model.clone();clone.set("id",clone.cid);clone.set("parent",wrapper.get("id"));clone.set("order",0);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);this.appendTemplate(id,view);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=ElementModel},{"./element-base":27}],33:[function(require,module,exports){var WrapperModel=require("./../element-wrapper"),SectionModel;SectionModel=WrapperModel.extend({validTarget:function(that,region){return"tailor_section"==that.get("tag")&&!_.contains(["left","right","center"],region)}});module.exports=SectionModel},{"./../element-wrapper":31}],34:[function(require,module,exports){var CanvasRegion=Backbone.Marionette.Region.extend({initialize:function(){this.listenTo(app.channel,"canvas:dragstart",this.onDragStart);this.listenTo(app.channel,"canvas:dragend",this.onDragEnd)},onDragStart:function(view,region,options){this.el.classList.add("is-active")},onDragEnd:function(view,region,options){this.el.classList.remove("is-active")}});module.exports=CanvasRegion},{}],35:[function(require,module,exports){var $=Backbone.$,$win=$(window),$doc=$(document),CanvasCollectionView=require("./show/canvas-view"),CanvasModule;CanvasModule=Marionette.Module.extend({onStart:function(){this._model=null;this._isDragging=false;this.collection=app.channel.request("canvas:elements");this.addEventListeners();this.showCanvas();app.channel.trigger("module:canvas:ready",this)},addEventListeners:function(){this.listenTo(app.channel,"canvas:dragstart",this.onDragStart);this.listenTo(app.channel,"canvas:dragover",this.onDragOver);this.listenTo(app.channel,"canvas:dragend",this.onDragEnd);this.listenTo(app.channel,"canvas:drop",this.onDrop);$doc.on("click dragover",this.reset.bind(this));$win.on("resize",this.reset.bind(this))},showCanvas:function(){app.canvasRegion.show(new CanvasCollectionView({collection:this.collection}))},onDragStart:function(e,view){var collection=view.model.collection;if("function"===typeof collection.hasSelectedParent&&collection.hasSelectedParent(view.model)){return}this._view=view;this._model=view.model;this._isDragging=true;view.el.classList.add("is-dragging");if("element"==view.model.get("collection")){var testVar=window.DataTransfer||window.Clipboard;if("setDragImage"in testVar.prototype){var dragImage=document.createElement("img");dragImage.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";e.dataTransfer.setDragImage(dragImage,0,0)}}e.dataTransfer.effectAllowed="copyMove";e.dataTransfer.setData("Text",this._model.cid);e.stopPropagation()},onDragOver:function(e,view){if(!this._isDragging){return}if(e.pageY){var scrollY=window.scrollY||document.documentElement.scrollTop;if(e.pageY-scrollY<40){window.scrollTo(0,scrollY-20)}else if(scrollY+window.innerHeight-e.pageY<40){window.scrollTo(0,scrollY+20)}}var action="element"===this._model.get("collection")&&e.shiftKey?"copy":"move";if("move"===action&&view.model===this._model){this.reset();e.stopPropagation();return}var region=this._getDropRegion(e,view);if(!view.model.validTarget(this._model,region)){return}e.dataTransfer.dropEffect=action;app.channel.trigger("canvas:guide",view,region);e.preventDefault();e.stopPropagation()},onDrop:function(e,view){if(!this._isDragging){return}var model=this._model;var region=this._getDropRegion(e,view);if(!view.model.validTarget(model,region)){return}var action;if("element"===model.get("collection")){action=e.shiftKey?"copy":"move";if("move"===action&&view.model===model){return}}else{action="add"}model.trigger("element:"+action+":"+region,view,this._view);app.channel.trigger("element:"+action,model);this.collection.sort({silent:true});e.preventDefault();e.stopPropagation()},onDragEnd:function(e,view){if(!this._isDragging){return}this._isDragging=false;this._view.el.classList.remove("is-dragging");this.reset()},reset:function(){app.channel.trigger("canvas:reset")},_getPoint:function(e){if(e.targetTouches){return{x:e.targetTouches[0].clientX,y:e.targetTouches[0].clientY}}return{x:e.clientX,y:e.clientY}},_getDropRegion:function(e,view){var point=this._getPoint(e);var rect=view.el.getBoundingClientRect();var width=rect.width/2;var height=rect.height/2;var top=rect.top+(rect.height-height)/2;var left=rect.left+(rect.width-width)/2;if(left<=point.x&&point.x<=left+width&&top<=point.y&&point.y<=top+height){return"center"}else{var x=(point.x-(rect.left+width))/width;var y=(point.y-(rect.top+height))/height;if(Math.abs(x)>Math.abs(y)){return x>0?"right":"left"}return y>0?"bottom":"top"}}});module.exports=CanvasModule},{"./show/canvas-view":36}],36:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({behaviors:{Container:{}},getChildView:function(){return Tailor.lookup("tailor_section","wrapper","Views")},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return!child.get("parent")},_updateIndices:function(view,increment,index){if(increment){view._index=index;view.model._changing=false;view.model.set("order",index)}this.children.each(function(laterView){if(laterView._index>=view._index){laterView._index+=increment?1:-1;laterView.model.set("order",laterView._index)}},this)},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}}})},{}],37:[function(require,module,exports){var Stylesheet=require("./stylesheet"),CSSModule;CSSModule=Marionette.Module.extend({onStart:function(options){this.stylesheets=[];this.collection=app.channel.request("canvas:elements");this.createSheets(options.mediaQueries||{});this.addRules(options.cssRules||{});this.addEventListeners();app.channel.trigger("module:css:ready",this)},addEventListeners:function(){this.listenTo(app.channel,"css:add",this.addRules);this.listenTo(app.channel,"css:delete",this.deleteRules);this.listenTo(app.channel,"css:update",this.updateRules);this.listenTo(app.channel,"css:copy",this.copyRules);this.listenTo(app.channel,"css:clear",this.clearRules);this.listenTo(this.collection,"destroy",this.onDestroy)},createSheet:function(id,min,max){var media="only screen";if(min){media+=" and (min-width: "+min+")"}if(max){media+=" and (max-width: "+max+")"}return new Stylesheet(id,media)},createSheets:function(mediaQueries){_.each(mediaQueries,function(atts,id){if(!_.isEmpty(atts.min)){if(!_.isEmpty(atts.max)){this.stylesheets[id+"-up"]=this.createSheet(id+"-up",atts.min);this.stylesheets[id]=this.createSheet(id,atts.min,atts.max)}else{this.stylesheets[id]=this.createSheet(id,atts.min)}}else{if(!_.isEmpty(atts.max)){this.stylesheets[id]=this.createSheet(id,null,atts.max)}else{this.stylesheets[id]=this.createSheet(id)}}},this);app.channel.trigger("module:css:stylesheets:ready",this)},getSheet:function(id){if(this.stylesheets.hasOwnProperty(id)){return this.stylesheets[id]}return false},addRules:function(cssRules){for(var queryId in cssRules){if(cssRules.hasOwnProperty(queryId)){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].addRules(cssRules[queryId])}}}},clearRules:function(){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].clearRules()}}},copyRules:function(elementId,newElementId){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){var rules=this.stylesheets[queryId].getRules(elementId);if(rules.length){for(var rule in rules){if(rules.hasOwnProperty(rule)){rules[rule].selectors=rules[rule].selectors.replace(new RegExp(elementId,"g"),newElementId)}}var rulesSet={};rulesSet[queryId]={};rulesSet[queryId][newElementId]=rules;this.addRules(rulesSet)}}}},deleteRules:function(elementId,settingId){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].deleteRules(elementId,settingId)}}},updateRules:function(elementId,cssRules){this.deleteRules(elementId);this.addRules(cssRules)},onReset:function(){this.clearRules()},onDestroy:function(model){this.deleteRules(model.get("id"))}});module.exports=CSSModule},{"./stylesheet":38}],38:[function(require,module,exports){function Stylesheet(id,media){this.id=id;this.initialize(media)}Stylesheet.prototype={initialize:function(media){this.stylesheet=this.createStylesheet(media);this.sheet=this.stylesheet.sheet;this.lookup=[]},createStylesheet:function(media){var style=document.createElement("style");style.appendChild(document.createTextNode(""));media=media||"screen";style.setAttribute("media",media);style.setAttribute("id","tailor-"+this.id);document.head.appendChild(style);return style},addRules:function(ruleSet){for(var elementId in ruleSet){if(ruleSet.hasOwnProperty(elementId)){this.lookup=this.lookup||[];for(var i in ruleSet[elementId]){if(ruleSet[elementId].hasOwnProperty(i)){this.addRule(elementId,ruleSet[elementId][i])}}}}},addRule:function(elementId,rule){if(this.checkRule(rule)){var selectors=Tailor.CSS.parseSelectors(rule["selectors"],elementId);var declarations=Tailor.CSS.parseDeclarations(rule["declarations"]);if(!_.isEmpty(declarations)){var settingId=rule["setting"];Tailor.CSS.addRule(this.sheet,selectors,declarations,this.lookup.length);this.lookup.push({elementId:elementId,settingId:settingId})}}},checkRule:function(rule){return _.has(rule,"selectors")&&_.has(rule,"declarations")&&_.has(rule,"setting")},getRules:function(elementId){var rules=[];for(var i=0;i-1){rules.push({selectors:rule.selectorText,declarations:rule.style.cssText,setting:this.lookup[i]["settingId"]||""})}}}return rules},deleteRules:function(elementId,settingId){for(var i=0;i1){module.collection.add(parents,{at:index+1})}else{parents[0].parent=parent;parents[0].order=index;module.collection.add(parents)}app.channel.trigger("template:add",model)}canvas.classList.remove("is-loading")}})}};app.channel.on("template:load",api.loadTemplate);app.channel.trigger("module:templates:ready",this)}});module.exports=TemplateModule},{}],41:[function(require,module,exports){var SelectRegion=Backbone.Marionette.Region.extend({onShow:function(view,region,options){view._view.el.classList.add("is-selected")},onEmpty:function(view,region,options){view._view.el.classList.remove("is-selected")}});module.exports=SelectRegion},{}],42:[function(require,module,exports){var GuideView=Marionette.ItemView.extend({template:false,position:function(view,drop){var $el=view.$el;var offset=$el.offset();var parentOffset=this.$el.offsetParent().offset();this.el.style.visibility="visible";this.el.className="guide guide--"+drop+" guide--"+view.model.get("tag");this.el.style.left=offset.left-parentOffset.left+"px";this.el.style.top=offset.top-parentOffset.top+"px";this.el.style.width=$el.outerWidth()+"px";this.el.style.height=$el.outerHeight()+"px";this.el.style.opacity=1},reset:function(){this.el.style="";this.el.style.visibility="hidden";this.el.style.opacity=0}});module.exports=GuideView},{}],43:[function(require,module,exports){var SelectMenuItemView=Marionette.ItemView.extend({tagName:"div",className:"select__item",events:{click:"onClick"},getTemplate:function(){return _.template("<%= label %>")},onClick:function(e){if(0===this._index){this.triggerMethod("toggle")}else{this.model.trigger("select")}e.stopPropagation()}});module.exports=SelectMenuItemView},{}],44:[function(require,module,exports){var SelectMenuItemView=require("./select-menu-item"),SelectMenuView;SelectMenuView=Marionette.CompositeView.extend({className:"select",childView:SelectMenuItemView,childViewContainer:".select__menu",ui:{add:".js-add",edit:".js-edit",copy:".js-copy",delete:".js-delete"},events:{"click @ui.add":"addElement","click @ui.edit":"editElement","click @ui.copy":"copyElement","click @ui.delete":"deleteElement"},modelEvents:{destroy:"destroy"},childEvents:{toggle:"toggleMenu"},template:"#tmpl-tailor-tools-select",serializeData:function(){var data=Backbone.Marionette.CompositeView.prototype.serializeData.apply(this,arguments);data.type=this.model.get("type");data.siblings=this.collection.where({parent:this.model.get("parent")}).length;return data},initialize:function(options){this._view=options.view},_filteredSortedModels:function(){var models=[];var model=this.model;while("undefined"!==typeof model){models.push(model);model=this.collection.get(model.get("parent"))}return models},onDomRefresh:function(){var thisRect=this.el.parentNode.getBoundingClientRect();var thatRect=this._view.el.getBoundingClientRect();var style=getComputedStyle(this._view.el,null);var borderTop=parseInt(style.getPropertyValue("border-top-width"),10);var borderRight=parseInt(style.getPropertyValue("border-right-width"),10);var borderBottom=parseInt(style.getPropertyValue("border-bottom-width"),10);var borderLeft=parseInt(style.getPropertyValue("border-left-width"),10);var left=Math.round(parseFloat(thatRect.left))+borderLeft;var right=Math.min(window.innerWidth+1,Math.round(thatRect.right)-borderRight);var width=right-left;this.el.style.top=Math.round(parseFloat(thatRect.top-parseFloat(thisRect.top)))+borderTop+"px";this.el.style.left=left-thisRect.left+"px";this.el.style.width=width+"px";this.el.style.height=Math.round(parseFloat(thatRect.height))-borderTop-borderBottom+"px";var controls=this.el.querySelector(".select__controls");var menu=this.el.querySelector(".select__menu");if(menu&&controls){var menuRect=menu.getBoundingClientRect();var controlsRect=controls.getBoundingClientRect();if(menuRect.width+controlsRect.width>parseInt(this.el.style.width,10)){this.el.classList.add("is-minimal")}}},addElement:function(){var child=this.model.collection.createChild(this.model);child.set("collection","library",{silent:true});app.channel.trigger("element:add",child)},editElement:function(){app.channel.trigger("modal:open",this.model)},copyElement:function(){this.model.copyAfter(this._view,this._view);app.channel.trigger("element:copy",this.model)},deleteElement:function(){this.model.trigger("destroy",this.model);app.channel.trigger("element:delete",this.model)},toggleMenu:function(){this.$el.toggleClass("is-expanded")}});module.exports=SelectMenuView},{"./select-menu-item":43}],45:[function(require,module,exports){var GuideView=require("./show/guide"),SelectorView=require("./show/select-menu"),ToolsModule;ToolsModule=Marionette.Module.extend({onStart:function(){var guide=new GuideView({el:"#guide"}).render();var api={positionGuide:function(view,drop){guide.position(view,drop)},selectElement:function(view){app.selectRegion.show(new SelectorView({model:view.model,collection:app.channel.request("canvas:elements"),view:view}))},resetGuide:function(){guide.reset();app.selectRegion.empty()},getSelectedElement:function(){var select=app.selectRegion.currentView;return select?select.model:null}};this.listenTo(app.channel,"canvas:guide",api.positionGuide);this.listenTo(app.channel,"canvas:select",api.selectElement);this.listenTo(app.channel,"canvas:reset",api.resetGuide);this.listenTo(app.channel,"element:refresh:template",api.resetGuide);app.channel.reply("canvas:element:selected",api.getSelectedElement);app.channel.trigger("module:tools:ready",this)}});module.exports=ToolsModule},{"./show/guide":42,"./show/select-menu":44}],46:[function(require,module,exports){require("./preview/helpers");require("./preview/behaviors");require("./preview/css")},{"./preview/behaviors":47,"./preview/css":48,"./preview/helpers":49}],47:[function(require,module,exports){(function($,app,SettingAPI,ElementAPI){ElementAPI.onRender("tailor_carousel",function(atts,model){var carousel=this;var options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:false,fade:"1"==atts.fade&&"1"==atts.items_per_row,slidesToShow:parseInt(atts.items_per_row,10)||1,adaptiveHeight:true};carousel.$el.tailorCarousel(options)});ElementAPI.onRender("tailor_content",function(atts,model){if(this.$el.find(".is-lightbox-image").length>0){this.$el.tailorLightbox({disableOn:function(){return $el.hasClass("is-selected")}})}});ElementAPI.onRender("tailor_gallery",function(atts,model){var $el=this.$el;var options;if("carousel"==atts.layout){options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:"1"==atts.dots,fade:"1"==atts.fade&&"1"==atts.items_per_row,infinite:false,slidesToShow:parseInt(atts.items_per_row,10)||2};$el.tailorSimpleCarousel(options)}else if("slideshow"==atts.layout){options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:false,fade:true,items:".tailor-slideshow__slide",adaptiveHeight:true,draggable:false,speed:250};if("1"==atts.thumbnails){options.customPaging=function(slider,i){var thumb=$(slider.$slides[i]).data("thumb");return''};options.dots=true}$el.tailorSlideshow(options)}else if(atts.masonry){$el.tailorMasonry()}if(this.el.classList.contains("is-lightbox-gallery")){$el.tailorLightbox({disableOn:function(){return $el.hasClass("is-selected")}})}});ElementAPI.onRender("tailor_map",function(atts,model){this.$el.tailorGoogleMap()});ElementAPI.onRender("tailor_posts",function(atts,model){var $el=this.$el;var options;if("carousel"==atts.layout){options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:"1"==atts.dots,fade:"1"==atts.fade&&"1"==atts.items_per_row,infinite:false,slidesToShow:parseInt(atts.items_per_row,10)||2};this.$el.tailorSimpleCarousel(options)}else if(atts.masonry){$el.tailorMasonry()}});ElementAPI.onRender("tailor_section",function(atts,model){if(atts["background_image"]&&atts["parallax"]&&1==atts["parallax"]){this.$el.tailorParallax()}});ElementAPI.onRender("tailor_tabs",function(atts,model){this.$el.tailorTabs()});ElementAPI.onRender("tailor_toggles",function(atts,model){this.$el.tailorToggles()})})(window.jQuery,window.app,window.Tailor.Api.Setting,window.Tailor.Api.Element)},{}],48:[function(require,module,exports){var $=Backbone.$,$win=$(window);(function(window,app,SettingAPI){var cssRules=window._pageRules||[];var cssCollection={_tailor_section_width:"",_tailor_column_spacing:"",_tailor_element_spacing:"",_tailor_page_css:""};var stylesheet=document.createElement("style");stylesheet.appendChild(document.createTextNode(""));stylesheet.setAttribute("media","screen");stylesheet.setAttribute("id","tailor-settings");document.head.appendChild(stylesheet);function getStyleValues(string){var values;if(-1!=string.indexOf(",")){values=string.split(",")}else{values=string.split("-")}if(2==values.length){values=_.object(["top","bottom"],values)}else if(4==values.length){values=_.object(["top","right","bottom","left"],values)}else{values={}}return values}function getMediaQuery(string){var query="";_.each(["_tablet","_mobile"],function(target){if(string.substring(string.length-target.length)==target){query=target.substring(1)}});return query}function generateCSS(settingId,value){cssCollection[settingId]="";value=_.isString(value)?value.trim():value;if(!_.isEmpty(value)){_.each(cssRules[settingId],function(rule){var selectors=Tailor.CSS.parseSelectors(rule.selectors);var declarations=Tailor.CSS.parseDeclarations(rule.declarations).replace(/\{\{(.*?)\}\}/g,value);cssCollection[settingId]+="\n"+selectors+" {"+declarations+"}"})}}function updateStylesheet(){var value="";for(var settingId in cssCollection){if(cssCollection.hasOwnProperty(settingId)){value+=cssCollection[settingId]}}stylesheet.innerHTML=value;$win.trigger("resize")}app.channel.on("module:css:stylesheets:ready",function(cssModule){var settings=app.channel.request("sidebar:settings");if(settings&&settings.length){settings.each(function(setting){var id=setting.get("id");var value=setting.get("value");value=_.isString(value)?value.trim():value;if(!_.isEmpty(value)&&cssCollection.hasOwnProperty(id)){if(cssRules.hasOwnProperty(id)){generateCSS(id,value)}else{cssCollection[id]=value}}})}updateStylesheet();var ids=["_tailor_section_width","_tailor_column_spacing","_tailor_element_spacing"];_.each(ids,function(settingId){if(cssRules.hasOwnProperty(settingId)){SettingAPI.onChange("sidebar:"+settingId,function(to,from){generateCSS(settingId,to);updateStylesheet()})}});SettingAPI.onChange("sidebar:_tailor_page_css",function(to,from){cssCollection["_tailor_page_css"]=to;updateStylesheet()});SettingAPI.onChange("sidebar:_post_title",function(to,from){$("h1, h2, h1 a, h2 a").each(function(){if(from==this.textContent){this.textContent=to}})});window.Tailor.Settings.overrides={"*":{},tailor_button:{color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"color","tailorValidateColor"],background_color:[[".tailor-button__inner"],"background-color","tailorValidateColor"],background_color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"background-color","tailorValidateColor"],border_color:[[".tailor-button__inner"],"border-color","tailorValidateColor"],border_color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"border-color","tailorValidateColor"],padding:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],padding_tablet:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],padding_mobile:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],margin:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],margin_tablet:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],margin_mobile:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],border_width:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_radius:[[".tailor-button__inner"],"border-radius","tailorValidateUnit"],shadow:[[".tailor-button__inner"],"box-shadow"]},tailor_card:{border_color:[["",".tailor-card__header"],"border-color","tailorValidateColor"],padding:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"],padding_tablet:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"],padding_mobile:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"]},tailor_carousel:{border_color:[["",".slick-dots"],"border-color","tailorValidateColor"]},tailor_grid:{border_color:[[".tailor-grid__item"],"border-color","tailorValidateColor"],border_style:function(to,from,model){return[{selectors:["&.tailor-grid--bordered .tailor-grid__item"],declarations:{"border-style":tailorValidateString(to)+"!important"}}]},border_width:function(to,from,model){return[{selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]},border_width_tablet:function(to,from,model){return[{media:"tablet",selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]},border_width_mobile:function(to,from,model){return[{media:"mobile",selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]}},tailor_grid_item:{padding:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"],padding_tablet:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"],padding_mobile:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"]},tailor_tabs:{border_color:[[".tailor-tabs__navigation-item",".tailor-tab"],"border-color","tailorValidateColor"]},tailor_tab:{background_color:[["&.tailor-tabs__navigation-item","&.tailor-tab"],"background-color","tailorValidateColor"],padding:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],padding_tablet:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],padding_mobile:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],border_width:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],background_repeat:[["&.tailor-tab"],"background-repeat","tailorValidateString"],background_position:[["&.tailor-tab"],"background-position","tailorValidateString"],background_size:[["&.tailor-tab"],"background-size","tailorValidateString"],background_attachment:[["&.tailor-tab"],"background-attachment","tailorValidateString"]},tailor_toggle:{border_color:[[".tailor-toggle__title",".tailor-toggle__body"],"border-color","tailorValidateColor"],border_style:[[".tailor-toggle__title",".tailor-toggle__body"],"border-style","tailorValidateString"],border_radius:[[".tailor-toggle__title",".tailor-toggle__body"],"border-radius","tailorValidateUnit"]},tailor_section:{max_width:[[".tailor-section__content"],"max-width","tailorValidateUnit"],max_width_tablet:[[".tailor-section__content"],"max-width","tailorValidateUnit"],max_width_mobile:[[".tailor-section__content"],"max-width","tailorValidateUnit"],min_height:[[".tailor-section__content"],"min-height","tailorValidateUnit"],min_height_tablet:[[".tailor-section__content"],"min-height","tailorValidateUnit"],min_height_mobile:[[".tailor-section__content"],"min-height","tailorValidateUnit"]}};function getDefinition(tag,id,definition){if(window.Tailor.Settings.overrides["*"].hasOwnProperty(id)){return window.Tailor.Settings.overrides["*"][id]}if(window.Tailor.Settings.overrides.hasOwnProperty(tag)&&window.Tailor.Settings.overrides[tag].hasOwnProperty(id)){return window.Tailor.Settings.overrides[tag][id]}return definition}function registerCallbacks(definitions){_.each(definitions,function(definition,id){SettingAPI.onChange("element:"+id,function(to,from,model){definition=getDefinition(model.get("tag"),id,definition);if("function"==typeof definition){return definition.call(this,to,from,model)}if(""==to){return[]}var rule={media:getMediaQuery(id),selectors:definition[0],declarations:{}};if("function"==typeof window[definition[2]]){rule.declarations[definition[1]]=window[definition[2]](to)}else{rule.declarations[definition[1]]=to}return[rule]})})}_.each(["horizontal_alignment","horizontal_alignment_tablet","horizontal_alignment_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){var media=getMediaQuery(id);if(""!=media){media="-"+media}if(from){this.el.classList.remove("u-text-"+from+media)}this.el.classList.add("u-text-"+to+media);if("tailor_list_item"==model.get("tag")){var atts=model.get("atts");if(!_.isEmpty(atts["graphic_background_color"])||!_.isEmpty(atts["graphic_background_color_hover"])){return[{selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==to?"0":"1em","padding-right":"right"==to?"1em":"0"}}]}else{return[{selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}}]}}})});_.each(["vertical_alignment","vertical_alignment_tablet","vertical_alignment_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){var media=getMediaQuery(id);if(""!==media){media="-"+media}if(from){this.el.classList.remove("u-align-"+from+media)}this.el.classList.add("u-align-"+to+media)})});_.each(["size","size_tablet","size_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){if("tailor_button"==model.get("tag")){var media=getMediaQuery(id);if(""!=media){media="-"+media}if(from){this.el.classList.remove("tailor-button--"+from+media)}this.el.classList.add("tailor-button--"+to+media)}})});registerCallbacks({width:[[],"width","tailorValidateUnit"],width_tablet:[[],"width","tailorValidateUnit"],width_mobile:[[],"width","tailorValidateUnit"],max_width:[[],"max-width","tailorValidateUnit"],max_width_tablet:[[],"max-width","tailorValidateUnit"],max_width_mobile:[[],"max-width","tailorValidateUnit"],min_height:[[],"min-height","tailorValidateUnit"],min_height_tablet:[[],"min-height","tailorValidateUnit"],min_height_mobile:[[],"min-height","tailorValidateUnit"], +min_item_height:[[".tailor-grid__item"],"min-height","tailorValidateUnit"]});registerCallbacks({color:[[],"color","tailorValidateColor"],color_hover:[[":hover"],"color","tailorValidateColor"],link_color:[["a"],"color","tailorValidateColor"],link_color_hover:[["a:hover"],"color","tailorValidateColor"],heading_color:[["h1","h2","h3","h4","h5","h6"],"color","tailorValidateColor"],background_color:function(to,from,model){var atts=model.get("atts");if(atts["background_image"]){return false}var definition=getDefinition(model.get("tag"),"background_color",[[],"background-color","tailorValidateColor"]);if("function"==typeof definition){return definition.call(this,to,from,model)}var rule={selectors:definition[0],declarations:{}};if("function"==typeof window[definition[2]]){rule.declarations[definition[1]]=window[definition[2]](to)}else{rule.declarations[definition[1]]=to}return[rule]},background_color_hover:[[":hover"],"background-color","tailorValidateColor"],border_color:[[],"border-color","tailorValidateColor"],border_color_hover:[[":hover"],"border-color","tailorValidateColor"],graphic_color:function(to,from,model){var tag=model.get("tag");if("tailor_box"==tag){return[{selectors:[".tailor-box__graphic"],declarations:{color:tailorValidateColor(to)}}]}else if("tailor_list_item"==tag){return[{selectors:[".tailor-list__graphic"],declarations:{color:tailorValidateColor(to)}}]}},graphic_color_hover:function(to,from,model){var tag=model.get("tag");if("tailor_box"==tag){return[{selectors:[".tailor-box__graphic:hover"],declarations:{color:tailorValidateColor(to)}}]}else if("tailor_list_item"==tag){return[{selectors:[".tailor-list__graphic:hover"],declarations:{color:tailorValidateColor(to)}}]}},graphic_background_color:function(to,from,model){var tag=model.get("tag");var rules=[];if("tailor_box"==tag){if(to){rules.push({selectors:[".tailor-box__graphic"],declarations:{"margin-bottom":"1em","background-color":tailorValidateColor(to),"text-align":"center"}})}}else if("tailor_list_item"==tag){var atts=model.get("atts");var alignment=atts["horizontal_alignment"];if(to){rules.push({selectors:[".tailor-list__graphic"],declarations:{"background-color":tailorValidateColor(to),"text-align":"center"}});rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{if(!_.isEmpty(atts["graphic_background_color_hover"])){rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}})}}}return rules},graphic_background_color_hover:function(to,from,model){var tag=model.get("tag");var rules=[];if("tailor_box"==tag){if(to){rules.push({selectors:[".tailor-box__graphic"],declarations:{"margin-bottom":"1em","text-align":"center"}});rules.push({selectors:[".tailor-box__graphic:hover"],declarations:{"background-color":tailorValidateColor(to)}})}}else if("tailor_list_item"==tag){var atts=model.get("atts");var alignment=atts["horizontal_alignment"];if(to){rules.push({selectors:[".tailor-list__graphic"],declarations:{"text-align":"center"}});rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}});rules.push({selectors:[".tailor-list__graphic:hover"],declarations:{"background-color":tailorValidateColor(to)}})}else{if(!_.isEmpty(atts["graphic_background_color"])){rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}})}}}return rules},title_color:[[".tailor-toggle__title"],"color","tailorValidateColor"],title_background_color:[[".tailor-toggle__title"],"background-color","tailorValidateColor"],navigation_color:function(to,from,model){return[{selectors:[".slick-active button:before"],declarations:{"background-color":tailorValidateColor(to)}},{selectors:[".slick-arrow:not( .slick-disabled )"],declarations:{color:tailorValidateColor(to)}}]}});registerCallbacks({class:function(to,from,model){var classNames;if(!_.isEmpty(from)){classNames=from.trim().split(/\s+(?!$)/g);for(var i in classNames){if(classNames.hasOwnProperty(i)){this.el.classList.remove(classNames[i])}}}if(!_.isEmpty(to)){classNames=to.trim().split(/\s+(?!$)/g);for(var j in classNames){if(classNames.hasOwnProperty(j)){this.el.classList.add(classNames[j])}}}},border_style:[[],"border-style","tailorValidateString"],border_radius:[[],"border-radius","tailorValidateUnit"],background_repeat:[[],"background-repeat","tailorValidateString"],background_position:[[],"background-position","tailorValidateString"],background_size:[[],"background-size","tailorValidateString"],background_attachment:[[],"background-attachment","tailorValidateString"],shadow:function(to,from,model){var definition=getDefinition(model.get("tag"),"shadow",[[]]);if("function"==typeof definition){return definition.call(this,to,from,model)}if(1==to){return[{selectors:definition[0],declarations:{"box-shadow":"0 2px 6px rgba(0, 0, 0, 0.1)"}}]}return[]}});_.each({margin:[[],"margin-{0}","tailorValidateUnit"],margin_tablet:[[],"margin-{0}","tailorValidateUnit"],margin_mobile:[[],"margin-{0}","tailorValidateUnit"],padding:[[],"padding-{0}","tailorValidateUnit"],padding_tablet:[[],"padding-{0}","tailorValidateUnit"],padding_mobile:[[],"padding-{0}","tailorValidateUnit"],border_width:[[],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[[],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[[],"border-{0}-width","tailorValidateUnit"]},function(definition,id){SettingAPI.onChange("element:"+id,function(to,from,model){definition=getDefinition(model.get("tag"),id,definition);if("function"==typeof definition){return definition.call(this,to,from,model)}var rules=[];var rule={media:getMediaQuery(id),selectors:definition[0],declarations:{}};_.each(getStyleValues(to),function(value,position){if("function"==typeof window[definition[3]]){rule.declarations[definition[1].replace("{0}",position)]=window[definition[2]](value)}else{rule.declarations[definition[1].replace("{0}",position)]=value}});if(_.keys(rule.declarations).length>0){rules.push(rule)}return rules})})})})(window,window.app,window.Tailor.Api.Setting)},{}],49:[function(require,module,exports){window.tailorValidateString=function(string){return string.replace(/[0-9]/g,"")};window.tailorValidateNumber=function(string){string=string.replace(/[^0-9,.]+/i,"");return!_.isEmpty(string)?string:"0"};window.tailorValidateColor=function(color){if(/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(color)){return color}if(isRGBA(color)){return color}return""};function isRGBA(color){return/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d*(?:\.\d+)?)\)$/.test(color)}window.tailorValidateUnit=function(value){var sign="";if("-"==value.charAt(0)){sign="-";value=value.substring(1)}return sign+tailorValidateNumber(value)+getUnit(value)};function getUnit(string){var map=["px","%","in","cm","mm","pt","pc","em","rem","ex","vw","vh"];var matches=string.match(new RegExp(map.join("|")));if(matches){return matches[0]}return"px"}},{}],50:[function(require,module,exports){var $=window.jQuery,$win=$(window),app=window.app,cssModule,callbacks={sidebar:[],element:[]};function checkQuery(query){if(!query||!_.contains(_.keys(cssModule.stylesheets),query)){query="all"}return query}var onSidebarChange=function(setting){var settingId=setting.get("id");if(_.isEmpty(callbacks["sidebar"][settingId])){return}_.each(callbacks["sidebar"][settingId],function(callback){callback.apply(window,[setting.get("value"),setting.previous("value")])});$win.trigger("resize")};var onElementChange=function(setting,view){var elementId=view.model.get("id");var settingId=setting.get("id");if(!callbacks["element"].hasOwnProperty(settingId)||0==callbacks["element"][settingId].length){return}if(1==callbacks["element"][settingId].length){cssModule.deleteRules(elementId,settingId)}var ruleSets={};var rules;_.each(callbacks["element"][settingId],function(callback){if("function"==typeof callback){rules=callback.apply(view,[setting.get("value"),setting.previous("value"),view.model]);if(false===rules){view.model.trigger("change:atts",view.model,view.model.get("atts"))}else if(_.isArray(rules)&&rules.length>0){for(var rule in rules){if(rules.hasOwnProperty(rule)){if(!rules[rule].hasOwnProperty("selectors")||!rules[rule].hasOwnProperty("declarations")){continue}var query=checkQuery(rules[rule].media);ruleSets[query]=ruleSets[query]||{};ruleSets[query][elementId]=ruleSets[query][elementId]||[];if(_.keys(rules[rule].declarations).length>0){ruleSets[query][elementId].push({selectors:rules[rule].selectors,declarations:rules[rule].declarations,setting:rules[rule].setting||settingId})}}}cssModule.addRules(ruleSets)}}})};app.listenTo(app.channel,"sidebar:setting:change",onSidebarChange);app.listenTo(app.channel,"element:setting:change",onElementChange);app.channel.on("module:css:stylesheets:ready",function(module){cssModule=module});function registerCallback(type,id,callback){if("function"===typeof callback){callbacks[type][id]=callbacks[type][id]||[];callbacks[type][id].push(callback)}}module.exports={onChange:function(id,callback){var parts=id.split(":");if(parts.length>=2&&_.contains(["sidebar","element"],parts[0])){registerCallback(parts[0],parts[1],callback)}}}},{}],51:[function(require,module,exports){var DraggableBehaviors=Marionette.Behavior.extend({events:{dragstart:"onDragStart",dragend:"onDragEnd",drag:"onDrag"},onDragStart:function(e){app.channel.trigger("canvas:dragstart",e.originalEvent,this.view)},onDrag:function(e){app.channel.trigger("canvas:drag",e.originalEvent,this.view)},onDragEnd:function(e){app.channel.trigger("canvas:dragend",e.originalEvent,this.view)}});module.exports=DraggableBehaviors},{}],52:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],53:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],54:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],55:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],56:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],58:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],59:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},initialize:function(){this.$el.tabs()}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],60:[function(require,module,exports){var $=jQuery,Ajax;Ajax={url:window.ajaxurl,post:function(action,data){return ajax.send({data:_.isObject(action)?action:_.extend(data||{},{action:action})})},send:function(action,options){if(_.isObject(action)){options=action}else{options=options||{};options.data=_.extend(options.data||{},{action:action,tailor:1})}options=_.defaults(options||{},{type:"POST",url:ajax.url,context:this});return $.Deferred(function(deferred){if(options.success){deferred.done(options.success)}var onError=options.error?options.error:ajax.onError;deferred.fail(onError);delete options.success;delete options.error;$.ajax(options).done(function(response){if(response==="1"||response===1){response={success:true}}if(_.isObject(response)&&!_.isUndefined(response.success)){deferred[response.success?"resolveWith":"rejectWith"](this,[response.data])}else{deferred.rejectWith(this,[response])}}).fail(function(){deferred.rejectWith(this,arguments)})}).promise()},onError:function(response){if(!Tailor.Notify){console.error(response);return}if(response&&response.hasOwnProperty("message")){Tailor.Notify(response.message)}else if("0"==response){Tailor.Notify(window._l10n.expired)}else if("-1"==response){Tailor.Notify(window._l10n.invalid)}else{Tailor.Notify(window._l10n.error)}}};window.ajax=Ajax;module.exports=Ajax},{}],61:[function(require,module,exports){var CSS={addRule:function(sheet,selector,declaration,index){if("insertRule"in sheet){sheet.insertRule(selector+" {"+declaration+"}",sheet.cssRules.length)}else if("addRule"in sheet){sheet.addRule(selector,declaration,sheet.cssRules.length)}},deleteRule:function(sheet,index){if("deleteRule"in sheet){sheet.deleteRule(index)}else if("removeRule"in sheet){sheet.removeRule(index)}},parseSelectors:function(selectors,elementId){if(_.isString(selectors)){return selectors}var elementClass=elementId?".tailor-"+elementId:"";var prefix=".tailor-ui ";if(!selectors.length){return prefix+elementClass}selectors=selectors.map(function(selector){if(selector.indexOf("&")>-1){selector=selector.replace("&",elementClass)}else{var firstCharacter=selector.charAt(0);if(":"==firstCharacter||"::"==firstCharacter){selector=elementClass+selector}else{ +selector=elementClass+" "+selector}}return prefix+selector});return selectors.join(",")},parseDeclarations:function(declarations){if(_.isString(declarations)){return declarations}var declaration="";_.each(declarations,function(value,property){declaration+=property+":"+value+";"});return declaration}};module.exports=CSS},{}],62:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;i= 0 && this.$toggles.length > initial ) { - this.activate( this.$toggles[ initial ] ); - } - }, - - /** - * Caches the toggles and toggle content. - * - * @since 1.0.0 - */ - querySelectors : function() { - this.$content = this.$el.find( this.options.content ).hide(); - this.$toggles = this.$el - .find( this.options.toggles ) - .off() - .on( 'click', $.proxy( this.onClick, this ) ); - }, - - /** - * Activates a given toggle. - * - * @since 1.0.0 - * - * @param el - */ - activate: function( el ) { - var speed = this.options.speed; - var $el = $( el ); - - if ( this.options.accordion ) { - this.$toggles.filter( function() { - return this !== el; - } ).removeClass( 'is-active' ); - - this.$content.each( function() { - var $toggle = $( this ); - if ( el.nextElementSibling == this ) { - $toggle.slideToggle( speed ); - } - else { - $toggle.slideUp( speed ); - } - } ); - } - else { - this.$content - .filter( function() { return el.nextElementSibling == this; } ) - .slideToggle( speed ); - } - - $el.toggleClass( 'is-active' ); - - $win.trigger( 'resize' ); - }, - - /** - * Activates a toggle when it is clicked. - * - * @since 1.7.5 - * - * @param e - */ - onClick: function( e ) { - this.activate( e.target ); - e.preventDefault(); - }, + initialize : function() { + this.$el.tabs(); + } - /** - * Element listeners - */ - onDestroy: function( e ) { - this.$toggles.off(); - }, + // /** + // * Initializes the component. + // * + // * @since 1.7.5 + // */ + // onInitialize : function() { + // this.querySelectors(); + // + // var initial = this.options.initial - 1; + // if ( initial >= 0 && this.$toggles.length > initial ) { + // this.activate( this.$toggles[ initial ] ); + // } + // }, + // + // /** + // * Caches the toggles and toggle content. + // * + // * @since 1.0.0 + // */ + // querySelectors : function() { + // this.$content = this.$el.find( this.options.content ).hide(); + // this.$toggles = this.$el + // .find( this.options.toggles ) + // .off() + // .on( 'click', $.proxy( this.onClick, this ) ); + // }, + // + // /** + // * Activates a given toggle. + // * + // * @since 1.0.0 + // * + // * @param el + // */ + // activate: function( el ) { + // var speed = this.options.speed; + // var $el = $( el ); + // + // if ( this.options.accordion ) { + // this.$toggles.filter( function() { + // return this !== el; + // } ).removeClass( 'is-active' ); + // + // this.$content.each( function() { + // var $toggle = $( this ); + // if ( el.nextElementSibling == this ) { + // $toggle.slideToggle( speed ); + // } + // else { + // $toggle.slideUp( speed ); + // } + // } ); + // } + // else { + // this.$content + // .filter( function() { return el.nextElementSibling == this; } ) + // .slideToggle( speed ); + // } + // + // $el.toggleClass( 'is-active' ); + // + // $win.trigger( 'resize' ); + // }, + // + // /** + // * Activates a toggle when it is clicked. + // * + // * @since 1.7.5 + // * + // * @param e + // */ + // onClick: function( e ) { + // this.activate( e.target ); + // e.preventDefault(); + // }, + // + // /** + // * Element listeners + // */ + // onDestroy: function( e ) { + // this.$toggles.off(); + // }, + // + // /** + // * Child listeners + // */ + // onChangeChild: function() { + // this.querySelectors(); + // } - /** - * Child listeners - */ - onChangeChild: function() { - this.querySelectors(); - } - } ); /** diff --git a/assets/js/dist/frontend.min.js b/assets/js/dist/frontend.min.js index acfed83..5032a6a 100644 --- a/assets/js/dist/frontend.min.js +++ b/assets/js/dist/frontend.min.js @@ -1 +1 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o'};options.dots=true}$el.tailorSlideshow(options)});$(".is-lightbox-gallery").each(function(){var $el=$(this);if($el.hasClass("tailor-carousel")){$el.tailorLightbox({delegate:".slick-slide:not( .slick-cloned ) .is-lightbox-image"})}else{$el.tailorLightbox()}});$(".is-lightbox-image").tailorLightbox({delegate:false})}};window.Tailor.Components.Abstract=abstractComponent;window.Tailor.Components.Lightbox=require("./shared/components/ui/lightbox");window.Tailor.Components.Map=require("./shared/components/ui/map");window.Tailor.Components.Masonry=require("./shared/components/ui/masonry");window.Tailor.Components.Parallax=require("./shared/components/ui/parallax");window.Tailor.Components.Slideshow=require("./shared/components/ui/slideshow");window.Tailor.Components.Tabs=require("./shared/components/ui/tabs");window.Tailor.Components.Toggles=require("./shared/components/ui/toggles");require("./frontend/components/ui/carousel");$(document).ready(function(){window.Tailor.initElements()})},{"./frontend/components/ui/carousel":2,"./shared/components/ui/abstract":3,"./shared/components/ui/lightbox":4,"./shared/components/ui/map":5,"./shared/components/ui/masonry":6,"./shared/components/ui/parallax":7,"./shared/components/ui/slideshow":8,"./shared/components/ui/tabs":9,"./shared/components/ui/toggles":10,"./shared/utility/polyfills/classlist":11,"./shared/utility/polyfills/raf":12,"./shared/utility/polyfills/transitions":13}],2:[function(require,module,exports){var $=window.jQuery,Carousel;Carousel=function(el,options,callbacks){this.el=el;this.$el=$(el);this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.options=$.extend(this.defaults,options,this.$el.data());if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.callbacks=$.extend(this.callbacks,callbacks);this.initialize()};Carousel.prototype={defaults:{items:"> .tailor-carousel__item",speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,arrows:false,dots:false,fade:false,adaptiveHeight:true,draggable:true,infinite:false,prevArrow:'',nextArrow:''},callbacks:{onInitialize:function(){},onDestroy:function(){}},initialize:function(){this.$items=this.$wrap.find(this.options.items);this.slick();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},slick:function(){this.$wrap.slick(this.options)},unSlick:function(){this.$wrap.slick("unslick")},destroy:function(e){this.unSlick();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}}};$.fn.tailorCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorCarousel");if(!instance){$.data(this,"tailorCarousel",new Carousel(this,options,callbacks))}})}},{}],3:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],4:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],5:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],6:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],7:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],9:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],10:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},onInitialize:function(){this.querySelectors();var initial=this.options.initial-1;if(initial>=0&&this.$toggles.length>initial){this.activate(this.$toggles[initial])}},querySelectors:function(){this.$content=this.$el.find(this.options.content).hide();this.$toggles=this.$el.find(this.options.toggles).off().on("click",$.proxy(this.onClick,this))},activate:function(el){var speed=this.options.speed;var $el=$(el);if(this.options.accordion){this.$toggles.filter(function(){return this!==el}).removeClass("is-active");this.$content.each(function(){var $toggle=$(this);if(el.nextElementSibling==this){$toggle.slideToggle(speed)}else{$toggle.slideUp(speed)}})}else{this.$content.filter(function(){return el.nextElementSibling==this}).slideToggle(speed)}$el.toggleClass("is-active");$win.trigger("resize")},onClick:function(e){this.activate(e.target);e.preventDefault()},onDestroy:function(e){this.$toggles.off()},onChangeChild:function(){this.querySelectors()}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],11:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;i'};options.dots=true}$el.tailorSlideshow(options)});$(".is-lightbox-gallery").each(function(){var $el=$(this);if($el.hasClass("tailor-carousel")){$el.tailorLightbox({delegate:".slick-slide:not( .slick-cloned ) .is-lightbox-image"})}else{$el.tailorLightbox()}});$(".is-lightbox-image").tailorLightbox({delegate:false})}};window.Tailor.Components.Abstract=abstractComponent;window.Tailor.Components.Lightbox=require("./shared/components/ui/lightbox");window.Tailor.Components.Map=require("./shared/components/ui/map");window.Tailor.Components.Masonry=require("./shared/components/ui/masonry");window.Tailor.Components.Parallax=require("./shared/components/ui/parallax");window.Tailor.Components.Slideshow=require("./shared/components/ui/slideshow");window.Tailor.Components.Tabs=require("./shared/components/ui/tabs");window.Tailor.Components.Toggles=require("./shared/components/ui/toggles");require("./frontend/components/ui/carousel");$(document).ready(function(){window.Tailor.initElements()})},{"./frontend/components/ui/carousel":2,"./shared/components/ui/abstract":3,"./shared/components/ui/lightbox":4,"./shared/components/ui/map":5,"./shared/components/ui/masonry":6,"./shared/components/ui/parallax":7,"./shared/components/ui/slideshow":8,"./shared/components/ui/tabs":9,"./shared/components/ui/toggles":10,"./shared/utility/polyfills/classlist":11,"./shared/utility/polyfills/raf":12,"./shared/utility/polyfills/transitions":13}],2:[function(require,module,exports){var $=window.jQuery,Carousel;Carousel=function(el,options,callbacks){this.el=el;this.$el=$(el);this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.options=$.extend(this.defaults,options,this.$el.data());if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.callbacks=$.extend(this.callbacks,callbacks);this.initialize()};Carousel.prototype={defaults:{items:"> .tailor-carousel__item",speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:false,adaptiveHeight:true,draggable:true,infinite:false,prevArrow:'',nextArrow:''},callbacks:{onInitialize:function(){},onDestroy:function(){}},initialize:function(){this.$items=this.$wrap.find(this.options.items);this.slick();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},slick:function(){this.$wrap.slick(this.options)},unSlick:function(){this.$wrap.slick("unslick")},destroy:function(e){this.unSlick();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}}};$.fn.tailorCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorCarousel");if(!instance){$.data(this,"tailorCarousel",new Carousel(this,options,callbacks))}})}},{}],3:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],4:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],5:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],6:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],7:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],9:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],10:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},initialize:function(){this.$el.tabs()}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],11:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;i0){for(var rule in rules){if(rules.hasOwnProperty(rule)){if(!rules[rule].hasOwnProperty("selectors")||!rules[rule].hasOwnProperty("declarations")){continue}var query=checkQuery(rules[rule].media);ruleSets[query]=ruleSets[query]||{};ruleSets[query][elementId]=ruleSets[query][elementId]||[];if(_.keys(rules[rule].declarations).length>0){ruleSets[query][elementId].push({selectors:rules[rule].selectors,declarations:rules[rule].declarations,setting:rules[rule].setting||settingId})}}}cssModule.addRules(ruleSets)}}})};app.listenTo(app.channel,"sidebar:setting:change",onSidebarChange);app.listenTo(app.channel,"element:setting:change",onElementChange);app.channel.on("module:css:stylesheets:ready",function(module){cssModule=module});function registerCallback(type,id,callback){if("function"===typeof callback){callbacks[type][id]=callbacks[type][id]||[];callbacks[type][id].push(callback)}}module.exports={onChange:function(id,callback){var parts=id.split(":");if(parts.length>=2&&_.contains(["sidebar","element"],parts[0])){registerCallback(parts[0],parts[1],callback)}}}},{}],2:[function(require,module,exports){var DraggableBehaviors=Marionette.Behavior.extend({events:{dragstart:"onDragStart",dragend:"onDragEnd",drag:"onDrag"},onDragStart:function(e){app.channel.trigger("canvas:dragstart",e.originalEvent,this.view)},onDrag:function(e){app.channel.trigger("canvas:drag",e.originalEvent,this.view)},onDragEnd:function(e){app.channel.trigger("canvas:dragend",e.originalEvent,this.view)}});module.exports=DraggableBehaviors},{}],3:[function(require,module,exports){var $=jQuery,Ajax;Ajax={url:window.ajaxurl,post:function(action,data){return ajax.send({data:_.isObject(action)?action:_.extend(data||{},{action:action})})},send:function(action,options){if(_.isObject(action)){options=action}else{options=options||{};options.data=_.extend(options.data||{},{action:action,tailor:1})}options=_.defaults(options||{},{type:"POST",url:ajax.url,context:this});return $.Deferred(function(deferred){if(options.success){deferred.done(options.success)}var onError=options.error?options.error:ajax.onError;deferred.fail(onError);delete options.success;delete options.error;$.ajax(options).done(function(response){if(response==="1"||response===1){response={success:true}}if(_.isObject(response)&&!_.isUndefined(response.success)){deferred[response.success?"resolveWith":"rejectWith"](this,[response.data])}else{deferred.rejectWith(this,[response])}}).fail(function(){deferred.rejectWith(this,arguments)})}).promise()},onError:function(response){if(!Tailor.Notify){console.error(response);return}if(response&&response.hasOwnProperty("message")){Tailor.Notify(response.message)}else if("0"==response){Tailor.Notify(window._l10n.expired)}else if("-1"==response){Tailor.Notify(window._l10n.invalid)}else{Tailor.Notify(window._l10n.error)}}};window.ajax=Ajax;module.exports=Ajax},{}],4:[function(require,module,exports){var Notification;require("./polyfills/transitions");Notification=function(options){this.options=_.extend({},this.defaults,options);this.el=document.createElement("div");this.el.className="notification notification--"+this.options.type;this.container=document.getElementById("tailor-notification-container")||document.body;this.initialize()};Notification.prototype={defaults:{message:"",type:"",ttl:3e3,onShow:function(){},onHide:function(){}},initialize:function(){this.el.innerHTML=this.options.message;this.container.insertBefore(this.el,this.container.firstChild)},show:function(){var notification=this;notification.el.classList.add("is-visible");if("function"==typeof notification.options.onShow){notification.options.onShow.call(notification)}notification.session=setTimeout(function(){notification.hide()},notification.options.ttl)},hide:function(){var obj=this;var onTransitionEnd=function(e){if(Modernizr.cssanimations){if(e.target!==obj.el){return false}obj.el.removeEventListener(window.transitionEndName,onTransitionEnd)}obj.container.removeChild(obj.el);if("function"==typeof obj.options.onShow){obj.options.onShow.call(obj)}};clearTimeout(obj.session);if(Modernizr.csstransitions){obj.el.addEventListener(window.transitionEndName,onTransitionEnd);obj.el.classList.remove("is-visible")}else{onTransitionEnd()}}};var notify=function(msg,type){var notification=new Notification({message:msg,type:type||"error"});notification.show()};module.exports=notify},{"./polyfills/transitions":7}],5:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;iparseInt(required,10);case"contains":if(_.isString(actual)){actual=actual.split(",")}if(_.isArray(required)){var intersection=_.intersection(required,actual);return 0!==intersection.length}return-1!==_.indexOf(actual,required)}}}};wp.media.view.settings.post.id=window.post.id;app.addRegions({content:"#tailor-sidebar-content",dialog:{selector:"#tailor-dialog-container",regionClass:require("./sidebar/modules/dialog/dialog-region")},modal:{selector:"#tailor-modal-container",regionClass:require("./sidebar/modules/modal/modal-region")}});Tailor.Models.Container=require("./sidebar/entities/models/element-container");Tailor.Models.Wrapper=require("./sidebar/entities/models/element-wrapper");Tailor.Models.Section=require("./sidebar/entities/models/element-wrapper");Tailor.Models.Default=require("./sidebar/entities/models/element");Tailor.Panels.Default=require("./sidebar/components/panels/panel-default");Tailor.Panels.Empty=require("./sidebar/components/panels/panel-empty");Tailor.Sections.Default=require("./sidebar/components/sections/section-default");Tailor.Controls.ButtonGroup=require("./sidebar/components/controls/button-group");Tailor.Controls.Checkbox=require("./sidebar/components/controls/checkbox");Tailor.Controls.Code=require("./sidebar/components/controls/code");Tailor.Controls.Colorpicker=require("./sidebar/components/controls/colorpicker");Tailor.Controls.Editor=require("./sidebar/components/controls/editor");Tailor.Controls.Gallery=require("./sidebar/components/controls/gallery");Tailor.Controls.Icon=require("./sidebar/components/controls/icon");Tailor.Controls.Image=require("./sidebar/components/controls/image");Tailor.Controls.InputGroup=require("./sidebar/components/controls/input-group");Tailor.Controls.Link=require("./sidebar/components/controls/link");Tailor.Controls.List=require("./sidebar/components/controls/list");Tailor.Controls.Radio=require("./sidebar/components/controls/radio");Tailor.Controls.Range=require("./sidebar/components/controls/range");Tailor.Controls.Select=require("./sidebar/components/controls/select");Tailor.Controls.SelectMulti=require("./sidebar/components/controls/select-multi");Tailor.Controls.Style=require("./sidebar/components/controls/style");Tailor.Controls.Switch=require("./sidebar/components/controls/switch");Tailor.Controls.Text=require("./sidebar/components/controls/text");Tailor.Controls.Textarea=require("./sidebar/components/controls/textarea");Tailor.Controls.Video=require("./sidebar/components/controls/video");Tailor.Controls.WidgetForm=require("./sidebar/components/controls/widget-form");Tailor.Controls.Default=require("./sidebar/components/controls/text");Tailor.Controls.Abstract=require("./sidebar/components/controls/abstract-control");function getName(string){string=string||"";return string.replace(/_|-|tailor_/gi," ").replace(/(?: |\b)(\w)/g,function(key){return key.toUpperCase().replace(/\s+/g,"")})}Tailor.lookup=function(tag,type,object){if(!Tailor.hasOwnProperty(object)){console.error("Object type "+object+" does not exist");return}var name=getName(tag);if(Tailor[object].hasOwnProperty(name)){return Tailor[object][name]}if(type){name=getName(type);if(Tailor[object].hasOwnProperty(name)){return Tailor[object][name]}}return Tailor[object].Default};app.on("start",function(options){app.module("module:library",require("./sidebar/modules/library/library"));app.module("module:templates",require("./sidebar/modules/templates/templates"));app.module("module:settings",require("./sidebar/modules/settings/settings"));app.module("module:history",require("./sidebar/modules/history/history"));app.module("module:sections",require("./sidebar/modules/sections/sections"));app.module("module:panels",require("./sidebar/modules/panels/panels"));app.module("module:modal",require("./sidebar/modules/modal/modal"));app.module("module:dialog",require("./sidebar/modules/dialog/dialog"));app.module("module:notification",require("./sidebar/modules/notifications/notifications"));app.module("module:devicePreview",require("./sidebar/modules/device-preview/device-preview"));require("./sidebar/preview");$doc.on("heartbeat-send",function(e,data){data["tailor_post_id"]=window.post.id});wp.heartbeat.interval(60);wp.heartbeat.connectNow();$win.on("beforeunload.tailor",function(e){if(app.hasUnsavedChanges()){return window._l10n.confirmPage}}).on("unload.tailor",function(e){window.ajax.send("tailor_unlock_post",{data:{post_id:options.postId,nonce:options.nonces.unlockPost}})})});$doc.ready(function(){app.start({postId:window.post.id,nonces:window._nonces,l10n:window._l10n||[],library:window._library||[],templates:window._templates||[],panels:window._panels||[],sections:window._sections||[],settings:window._settings||[],controls:window._controls||[]});app.channel.trigger("sidebar:initialize",app)})})(window,Backbone.$)},{"./shared/components/api/setting":1,"./shared/components/behaviors/draggable":2,"./shared/utility/ajax":3,"./shared/utility/notify":4,"./shared/utility/polyfills/classlist":5,"./shared/utility/polyfills/raf":6,"./shared/utility/polyfills/transitions":7,"./sidebar/app":9,"./sidebar/components/behaviors/panel":10,"./sidebar/components/behaviors/resizable":11,"./sidebar/components/controls/abstract-control":12,"./sidebar/components/controls/button-group":13,"./sidebar/components/controls/checkbox":14,"./sidebar/components/controls/code":15,"./sidebar/components/controls/colorpicker":16,"./sidebar/components/controls/editor":17,"./sidebar/components/controls/gallery":18,"./sidebar/components/controls/icon":19,"./sidebar/components/controls/image":20,"./sidebar/components/controls/input-group":21,"./sidebar/components/controls/link":22,"./sidebar/components/controls/list":25,"./sidebar/components/controls/radio":26,"./sidebar/components/controls/range":27,"./sidebar/components/controls/select":29,"./sidebar/components/controls/select-multi":28,"./sidebar/components/controls/style":30,"./sidebar/components/controls/switch":31,"./sidebar/components/controls/text":32,"./sidebar/components/controls/textarea":33,"./sidebar/components/controls/video":34,"./sidebar/components/controls/widget-form":35,"./sidebar/components/panels/panel-default":36,"./sidebar/components/panels/panel-empty":37,"./sidebar/components/sections/section-default":38,"./sidebar/entities/models/element":51,"./sidebar/entities/models/element-container":49,"./sidebar/entities/models/element-wrapper":50,"./sidebar/modules/device-preview/device-preview":56,"./sidebar/modules/dialog/dialog":58,"./sidebar/modules/dialog/dialog-region":57,"./sidebar/modules/history/history":60,"./sidebar/modules/library/library":62,"./sidebar/modules/modal/modal":65,"./sidebar/modules/modal/modal-region":64,"./sidebar/modules/notifications/notifications":73,"./sidebar/modules/panels/panels":74,"./sidebar/modules/sections/sections":79,"./sidebar/modules/settings/settings":81,"./sidebar/modules/templates/templates":84,"./sidebar/preview":85}],9:[function(require,module,exports){var $=Backbone.$,$doc=$(document),SidebarApplication;SidebarApplication=Marionette.Application.extend({el:document.querySelector("#tailor"),initialize:function(){this._collapsed=false;this._unsavedChanges=false;this.saveButton=document.querySelector("#tailor-save");this.allowableEvents=["canvas:initialize","element:add","element:move","element:resize","navigation:reorder","element:copy","element:delete","elements:restore","template:add","history:undo","history:redo","modal:open","modal:destroy"];this.addEventListeners()},hasUnsavedChanges:function(){return this._unsavedChanges},addEventListeners:function(){var sidebar=this;var events=["element:add","element:move","element:resize","navigation:reorder","element:copy","element:delete","modal:apply","template:add","sidebar:setting:change"];sidebar.listenTo(sidebar.channel,events.join(" "),function(){sidebar.saveButton.disabled=false;sidebar.saveButton.innerHTML=window._l10n.publish;sidebar._unsavedChanges=true});$("#tailor-collapse").on("click",function(){sidebar._collapsed=!sidebar._collapsed;sidebar.el.classList.toggle("is-collapsed",sidebar._collapsed);sidebar.saveButton.setAttribute("aria-expanded",!sidebar._collapsed);sidebar.triggerMethod("collapse:sidebar")});$(sidebar.saveButton).on("click",function(){sidebar.el.classList.add("is-saving");sidebar.saveButton.setAttribute("disabled",true);var models=sidebar.channel.request("canvas:elements");var settings=sidebar.channel.request("sidebar:settings");window.ajax.send("tailor_save",{data:{post_id:window.post.id,models:JSON.stringify(models.toJSON()),settings:JSON.stringify(settings.toJSON()),nonce:window._nonces.save},success:function(){sidebar.saveButton.disabled=true;sidebar.saveButton.innerHTML=window._l10n.saved;sidebar._unsavedChanges=false;sidebar.channel.trigger("sidebar:save")},error:function(response){sidebar.saveButton.disabled=false;if(response&&response.hasOwnProperty("message")){Tailor.Notify(response.message)}else if("0"==response){Tailor.Notify(window._l10n.expired)}else if("-1"==response){Tailor.Notify(window._l10n.invalid)}else{Tailor.Notify(window._l10n.error)}},complete:function(){sidebar.el.classList.remove("is-saving")}})});sidebar.listenTo(sidebar.channel,"canvas:handshake",sidebar.registerRemoteChannel);$doc.on("keydown",function(e){if(e.ctrlKey&&89==e.keyCode){if(!_.contains(["INPUT","SELECT","TEXTAREA"],e.target.tagName)){sidebar.channel.trigger("history:redo")}}});$doc.on("keydown",function(e){if(e.ctrlKey&&90==e.keyCode){if(!_.contains(["INPUT","SELECT","TEXTAREA"],e.target.tagName)){sidebar.channel.trigger("history:undo")}}})},registerRemoteChannel:function(){var sidebarApp=this;var iFrame=this.el.querySelector("#tailor-sidebar-preview");if(window.location.origin===iFrame.contentWindow.location.origin){var remoteChannel=iFrame.contentWindow.app.channel;app.channel.reply("canvas:elements",function(id){return remoteChannel.request("canvas:elements",id)});app.channel.reply("canvas:element:selected",function(){return remoteChannel.request("canvas:element:selected")});app.listenTo(remoteChannel,"all",sidebarApp.forwardRemoteEvent);app.el.classList.add("is-initialized");app.el.querySelector(".tailor-preview__viewport").classList.add("is-loaded")}},forwardRemoteEvent:function(eventName){if(_.contains(this.allowableEvents,eventName)){this.channel.trigger.apply(this.channel,arguments)}},maybeCollapse:function(e){if(13===e.keyCode){this.onCollapse()}},maybeSave:function(e){if(13===e.keyCode){this.onSave()}}});module.exports=SidebarApplication},{}],10:[function(require,module,exports){var PanelBehavior=Marionette.Behavior.extend({ui:{backButton:".back-button",helpButton:".help-button",helpDescription:".help-description",searchBar:".search"},events:{"click @ui.helpButton":"toggleHelp","change @ui.searchBar":"doSearch","input @ui.searchBar":"doSearch","keyup @ui.searchBar":"doSearch","search @ui.searchBar":"doSearch"},triggers:{"click @ui.backButton":"back"},toggleHelp:function(){this.ui.helpButton.toggleClass("is-open");this.ui.helpDescription.slideToggle(150)},doSearch:function(e){this.view.collection.doSearch(e.target.value)}});module.exports=PanelBehavior},{}],11:[function(require,module,exports){var ResizableBehavior=Marionette.Behavior.extend({ui:{handle:".modal__title"},events:{mousemove:"onMouseMove",mousedown:"onMouseDown","dblclick @ui.handle":"toggleFullScreen"},initialize:function(){this._isResizing=false;this._isResizing=false;this.$ghostPane=jQuery('
').appendTo("body");this.addEventListeners()},addEventListeners:function(){var behavior=this;window.addEventListener("resize",function(){behavior.checkPosition()},false)},detectEdges:function(e){var rect=this.el.getBoundingClientRect();var x=e.clientX-rect.left;var y=e.clientY-rect.top;var threshold=8;var edges=[];if(y=rect.height-threshold){edges.push("bottom")}if(x=rect.width-threshold){edges.push("right")}return edges},onMouseMove:function(e){if(this._isResizing||this._isDragging){return}this.$el.removeClass("top top-left top-right left right bottom bottom-left bottom-right is-draggable");var edges=this.detectEdges(e);if(edges.length&&!this.container.classList.contains("is-full-screen")&&!document.body.classList.contains("mce-fullscreen")){this.$el.addClass(edges.join("-"))}else if(e.target.classList.contains("modal__title")){this.el.classList.add("is-draggable")}},onMouseDown:function(e){if(this._isResizing||this._isDragging){return}var edges=this.detectEdges(e);if(edges.length&&!this.$container.hasClass("is-full-screen")&&!document.body.classList.contains("mce-fullscreen")){this.resize(e,edges)}else if(e.target===this.ui.handle.get(0)){this.drag(e)}},resize:function(e,edges){var that=this;var edge=edges.join("-");var direction=_.contains(edges,"top")||_.contains(edges,"left")?-1:1;this._isResizing=true;document.body.classList.add("is-dragging");document.addEventListener("mousemove",onResize,false);document.addEventListener("mouseup",onResizeEnd,false);var lastX=e.pageX;var lastY=e.pageY;var lastWidth=parseInt(that.container.style.width,10);var lastHeight=parseInt(that.container.style.height,10);function onResize(e){var xDifference=direction*(e.pageX-lastX);var yDifference=direction*(e.pageY-lastY);switch(edge){case"top":lastHeight=lastHeight+yDifference;if(lastHeight>400){that.container.style.height=lastHeight+"px";that.container.style.top=parseInt(that.container.style.top,10)-yDifference+"px"}break;case"bottom":lastHeight=lastHeight+yDifference;if(lastHeight>400){that.container.style.height=lastHeight+"px"}break;case"left":lastWidth=lastWidth+xDifference;if(lastWidth>300){that.container.style.width=lastWidth+"px";that.container.style.left=parseInt(that.container.style.left,10)-xDifference+"px"}break;case"right":lastWidth=lastWidth+xDifference;if(lastWidth>300){that.container.style.width=lastWidth+"px"}break;case"top-left":lastHeight=lastHeight+yDifference;lastWidth=lastWidth+xDifference;if(lastWidth>300){that.container.style.width=lastWidth+"px";that.container.style.left=parseInt(that.container.style.left,10)-xDifference+"px"}if(lastHeight>400){that.container.style.height=lastHeight+"px";that.container.style.top=parseInt(that.container.style.top,10)-yDifference+"px"}break;case"top-right":lastHeight=lastHeight+yDifference;lastWidth=lastWidth-xDifference;if(lastWidth>300){that.container.style.width=lastWidth+"px"}if(lastHeight>400){that.container.style.height=lastHeight+"px";that.container.style.top=parseInt(that.container.style.top,10)-yDifference+"px"}break;case"bottom-left":lastHeight=lastHeight-yDifference;lastWidth=lastWidth+xDifference;if(lastWidth>300){that.container.style.width=lastWidth+"px";that.container.style.left=parseInt(that.container.style.left,10)-xDifference+"px"}if(lastHeight>400){that.container.style.height=lastHeight+"px"}break;case"bottom-right":lastHeight=lastHeight+yDifference;lastWidth=lastWidth+xDifference;if(lastWidth>300){that.container.style.width=lastWidth+"px"}if(lastHeight>400){that.container.style.height=lastHeight+"px"}break}that.triggerResize(lastWidth,lastHeight);lastY=e.pageY;lastX=e.pageX}function onResizeEnd(e){that._isResizing=false;document.body.classList.remove("is-dragging");document.removeEventListener("mousemove",onResize,false);document.removeEventListener("mouseup",onResizeEnd,false);that.checkPosition(150)}},drag:function(e){var that=this;var lastX;var lastY;this._isDragging=true;document.addEventListener("mousemove",onDrag,false);document.addEventListener("mouseup",onDragEnd,false);function onDrag(e){document.body.classList.add("is-dragging");that.container.style.top=parseInt(that.container.style.top,10)+(e.pageY-lastY)+"px";that.container.style.left=parseInt(that.container.style.left,10)+(e.pageX-lastX)+"px";if(e.pageX<5){that.$ghostPane.css({display:"block"}).addClass("left")}else if(e.pageX>window.innerWidth-5){that.$ghostPane.css({display:"block"}).addClass("right")}else if(e.pageY<5){that.$ghostPane.css({display:"block"}).addClass("top")}else{that.resetGhostPane();if(that.container.classList.contains("is-full-screen")){that.$container.removeClass("is-full-screen is-full-screen-left is-full-screen-right");that.container.style.top=e.pageY-20+"px";that.container.style.left=e.pageX-parseInt(that.container.style.width,10)/2+"px";that.triggerResize(parseInt(that.container.style.width,10),parseInt(that.container.style.height,10))}}lastX=e.pageX;lastY=e.pageY}function onDragEnd(e){that._isDragging=false;document.body.classList.remove("is-dragging");document.removeEventListener("mousemove",onDrag,false);document.removeEventListener("mouseup",onDragEnd,false);that.maybeToggleFullScreen(e)}},maybeToggleFullScreen:function(e){var position;if(e.pageY<5){position="top"}else if(e.pageX<5){position="left"}else if(e.pageX>window.innerWidth-5){position="right"}if(position){this.enterFullScreen(position)}else{this.checkPosition(150)}},toggleFullScreen:function(){if(!this.container.classList.contains("is-full-screen")){this.enterFullScreen("top")}else{this.exitFullScreen()}},enterFullScreen:function(position){this.$container.removeClass("is-full-screen is-full-screen-left is-full-screen-right");this.container.classList.add("is-full-screen");this.container.classList.add("is-full-screen-"+position);var rect=this.container.getBoundingClientRect();this.triggerResize(rect.width,rect.height)},exitFullScreen:function(){this.$container.removeClass("is-full-screen is-full-screen-left is-full-screen-right");this.triggerResize(parseInt(this.container.style.width,10),parseInt(this.container.style.height,10));this.checkPosition(150);this.resetGhostPane()},triggerResize:function(width,height){this.view.trigger("modal:resize",width,height)},resetGhostPane:function(){this.$ghostPane.css({display:"none"});this.$ghostPane[0].className="ghost-pane"},onShow:function(){this.container=this.el.parentNode;this.$container=this.$el.parent();this.checkPosition()},checkPosition:function(duration){duration=duration||0;var width=parseInt(this.container.style.width,10);var height=parseInt(this.container.style.height,10);var top=parseInt(this.container.style.top,10);var left=parseInt(this.container.style.left,10);var css={};if(topwindow.scrollY+window.innerHeight){css.top=Math.max(window.scrollY+window.innerHeight-height,window.scrollY)}if(left<0){css.left=window.scrollX}else if(left+width>window.scrollX+window.innerWidth){css.left=Math.max(window.scrollX+window.innerWidth-width,window.scrollX)}if(duration){this.$container.animate(css,duration)}else{this.$container.css(css)}},onDestroy:function(){this.$ghostPane.remove()}});module.exports=ResizableBehavior},{}],12:[function(require,module,exports){var $=window.jQuery,AbstractControl;AbstractControl=Marionette.ItemView.extend({tagName:"li",media:"desktop",ui:{input:"input",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"blur @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},className:function(){return"control control--"+this.model.get("type")},getTemplate:function(){return"#tmpl-tailor-control-"+this.model.get("type")},serializeData:function(){var data=Backbone.Marionette.ItemView.prototype.serializeData.apply(this,arguments);data.values=this.getValues();data.hideDefault=this.checkDefault(data.values);data=this.addSerializedData(data);return data},addSerializedData:function(data){return data},checkDefault:function(values){var hide=true;_.each(this.getDefaults(),function(value,media){if(!_.isNull(value)&&values.hasOwnProperty(media)&&!_.isNull(values[media])&&value!==values[media]){hide=false}});return hide},initialize:function(){this.addEventListeners();this.checkDependencies()},addEventListeners:function(){_.each(this.getSettings(),function(setting){this.listenTo(setting,"change",this.onSettingChange)},this);this.listenTo(this.getSetting().collection,"change",this.checkDependencies)},checkDependencies:function(setting){setting=setting||this.getSetting();var dependencies=this.model.get("dependencies");var settingCollection=setting.collection;var visible=true;for(var id in dependencies){if(dependencies.hasOwnProperty(id)){var target=settingCollection.get(id);if(!target){continue}var condition=dependencies[id].condition;var actual=target.get("value");var required=dependencies[id].value;if(!Tailor.Helpers.checkCondition(condition,actual,required)){visible=false;break}}}this.$el.toggle(visible)},onRender:function(){this.updateControlGroups()},onMediaButtonChange:function(e){this.media=e.currentTarget.getAttribute("data-media");this.updateControlGroups()},onDefaultButtonChange:function(){this.restoreDefaults();this.render()},onFieldChange:function(){this.setValue(this.ui.input.filter('[name^="'+this.media+'"]').val())},onSettingChange:function(){this.updateDefaultButton()},updateControlGroups:function(){var media=this.media;this.ui.controlGroups.each(function(){$(this).toggleClass("is-hidden",media!=this.id)});this.ui.mediaButton.each(function(){$(this).toggleClass("active",media==this.getAttribute("data-media"))})},updateDefaultButton:function(){this.ui.defaultButton.toggleClass("is-hidden",this.checkDefault(this.getValues()))},getSettings:function(){return this.model.settings},getSetting:function(media){media=media||this.media;var settings=this.getSettings();for(var i in settings){if(settings.hasOwnProperty(i)){if(settings[i].media==media){return settings[i]}}}return false},getDefaults:function(){var defaults={};_.each(this.getSettings(),function(setting){defaults[setting.media]=setting.get("default")});return defaults},getValues:function(){var values={};_.each(this.getSettings(),function(setting){values[setting.media]=setting.get("value")||""});return values},getDefault:function(){return this.getSetting().get("default")},getValue:function(){return this.getSetting().get("value")},setValue:function(value){this.getSetting().set("value",value)},restoreDefaults:function(){_.each(this.getSettings(),function(setting){setting.set("value",setting.get("default")); - -})}});module.exports=AbstractControl},{}],13:[function(require,module,exports){var AbstractControl=require("./abstract-control"),ButtonGroupControl;ButtonGroupControl=AbstractControl.extend({ui:{input:".control__body .button",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{active:function(media,key){return key===this.values[media]?"active":""}},onFieldChange:function(e){this.ui.input.filter('[name^="'+this.media+'"]').removeClass("active");var button=e.currentTarget;button.classList.add("active");this.setValue(button.value)}});module.exports=ButtonGroupControl},{"./abstract-control":12}],14:[function(require,module,exports){var AbstractControl=require("./abstract-control"),CheckboxControl;CheckboxControl=AbstractControl.extend({events:{"change @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{checked:function(media,key){var values=this.values[media].split(",");return-1!==values.indexOf(key)?"checked":""}},onFieldChange:function(e){var values=[];_.each(this.ui.input.filter('[name^="'+this.media+'"]:checked'),function(field){if(field.checked){values.push(field.value||0)}});this.setValue(values.join(","))}});module.exports=CheckboxControl},{"./abstract-control":12}],15:[function(require,module,exports){var $=window.jQuery,AbstractControl=require("./abstract-control"),CodeControl;CodeControl=AbstractControl.extend({ui:{input:"textarea",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},addSerializedData:function(data){data.cid=this.cid;return data},onRender:function(){var control=this;var mode=control.model.get("mode");this.editors={};_.each(this.getValues(),function(value,media){var $field=control.ui.input.filter('[name^="'+media+"-"+control.cid+'"]');control.editors[media]=CodeMirror.fromTextArea($field.get(0),{mode:mode,lineNumbers:true,matchBrackets:true,continueComments:"Enter",viewportMargin:Infinity,extraKeys:{F11:function(cm){cm.setOption("fullScreen",!cm.getOption("fullScreen"))},Esc:function(cm){if(cm.getOption("fullScreen")){cm.setOption("fullScreen",false)}}}});control.editors[media].on("change",function(editor){control.setValue(editor.getValue())},this);setTimeout(function(){control.editors[media].refresh()},10)});this.updateControlGroups()},restoreDefaults:function(){_.each(this.getSettings(),function(setting,media){var value=setting.get("default")||"";setting.set("value",value)})},updateControlGroups:function(){var control=this;var media=this.media;this.ui.controlGroups.each(function(){$(this).toggleClass("is-hidden",media!=this.id)});this.ui.mediaButton.each(function(){$(this).toggleClass("active",media==this.getAttribute("data-media"))});control.editors[media].refresh()},onDestroy:function(){var control=this;_.each(this.getValues(),function(value,media){control.editors[media].off();control.editors[media].toTextArea()})}});module.exports=CodeControl},{"./abstract-control":12}],16:[function(require,module,exports){var $=window.jQuery,AbstractControl=require("./abstract-control"),ColorPickerControl;(function($){var image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==";var _before='',_after='
',_wrap='
',_button='';Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var hex=parseInt(this._color,10).toString(16);if(this.error)return"";if(hex.length<6){for(var i=6-hex.length-1;i>=0;i--){hex="0"+hex}}return"#"+hex};$.widget("wp.wpColorPicker",$.wp.wpColorPicker,{_create:function(){if(!$.support.iris){return}var self=this,el=self.element;$.extend(self.options,el.data());self.close=$.proxy(self.close,self);self.initialValue=el.val();el.addClass("wp-color-picker").hide().wrap(_wrap);self.wrap=el.parent();self.toggler=$(_before).insertBefore(el).css({backgroundColor:self.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current);self.pickerContainer=$(_after).insertAfter(el);self.button=$(_button);if(self.options.defaultColor){self.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString)}else{self.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear)}el.wrap('').after(self.button);el.iris({target:self.pickerContainer,hide:self.options.hide,width:self.options.width,mode:self.options.mode,palettes:self.options.palettes,change:function(event,ui){if(self.options.rgba){self.toggler.css({"background-image":"url("+image+")"}).html("");self.toggler.find("span").css({width:"100%",height:"100%",position:"absolute",top:0,left:0,"border-top-left-radius":"3px","border-bottom-left-radius":"3px",background:ui.color.toString()})}else{self.toggler.css({backgroundColor:ui.color.toString()})}if($.isFunction(self.options.change)){self.options.change.call(this,event,ui)}}});el.val(self.initialValue);self._addListeners();if(!self.options.hide){self.toggler.click()}},_addListeners:function(){var self=this;self.wrap.on("click.wpcolorpicker",function(event){event.stopPropagation()});self.toggler.click(function(){if(self.toggler.hasClass("wp-picker-open")){self.close()}else{self.open()}});self.element.change(function(event){var me=$(this),val=me.val();if(val===""||self.element.hasClass("iris-error")){if(self.options.rgba){self.toggler.removeAttr("style");self.toggler.find("span").css("backgroundColor","")}else{self.toggler.css("backgroundColor","")}if($.isFunction(self.options.clear)){self.options.clear.call(this,event)}}});self.toggler.on("keyup",function(event){if(event.keyCode===13||event.keyCode===32){event.preventDefault();self.toggler.trigger("click").next().focus()}});self.button.click(function(event){var me=$(this);if(me.hasClass("wp-picker-clear")){self.element.val("");if(self.options.rgba){self.toggler.removeAttr("style");self.toggler.find("span").css("backgroundColor","")}else{self.toggler.css("backgroundColor","")}if($.isFunction(self.options.clear)){self.options.clear.call(this,event)}}else if(me.hasClass("wp-picker-default")){self.element.val(self.options.defaultColor).change()}})}});$.widget("a8c.iris",$.a8c.iris,{_create:function(){this._super();this.options.rgba=this.element.data("rgba")||false;if(!this.element.is(":input")){this.options.alpha=false}if(typeof this.options.rgba!=="undefined"&&this.options.rgba){var self=this,_html='
',aContainer=$(_html).appendTo(self.picker.find(".iris-picker-inner")),aSlider=aContainer.find(".iris-slider-offset-alpha"),controls={aContainer:aContainer,aSlider:aSlider};$.each(controls,function(k,v){self.controls[k]=v});self.controls.square.css({"margin-right":"0"});var emptyWidth=self.picker.width()-self.controls.square.width()-20,stripsMargin=emptyWidth/6,stripsWidth=emptyWidth/2-stripsMargin;$.each(["aContainer","strip"],function(k,v){self.controls[v].width(stripsWidth).css({"margin-left":stripsMargin+"px"})});self._initControls();self._change()}},_initControls:function(){this._super();if(this.options.rgba){var self=this,controls=self.controls;controls.aSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(self._color._alpha*100),slide:function(event,ui){self._color._alpha=parseFloat(ui.value/100);self._change.apply(self,arguments)}})}},_change:function(){this._super();var self=this,el=self.element;if(this.options.rgba){var controls=self.controls,alpha=parseInt(self._color._alpha*100),color=self._color.toRgb(),gradient=["rgb("+color.r+","+color.g+","+color.b+") 0%","rgba("+color.r+","+color.g+","+color.b+", 0) 100%"],defaultWidth=self.options.defaultWidth,customWidth=self.options.customWidth,target=self.picker.closest(".wp-picker-container").find(".wp-color-result");controls.aContainer.css({background:"linear-gradient(to bottom, "+gradient.join(", ")+"), url("+image+")"});if(target.hasClass("wp-picker-open")){controls.aSlider.slider("value",alpha);if(self._color._alpha<1){var style=controls.strip.attr("style").replace(/rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g,"rgb($1$3$5)");controls.strip.attr("style",style);el.width(parseInt(defaultWidth+customWidth))}else{el.width(defaultWidth)}}}var reset=el.data("reset-alpha")||false;if(reset){self.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){self._color._alpha=1;self.active="external";self._change()})}},_addInputListeners:function(input){var self=this,debounceTimeout=100,callback=function(event){var color=new Color(input.val()),val=input.val();input.removeClass("iris-error");if(color.error){if(val!==""){input.addClass("iris-error")}}else{if(color.toString()!==self._color.toString()){if(!(event.type==="keyup"&&val.match(/^[0-9a-fA-F]{3}$/))){self._setOption("color",color.toString())}}}};input.on("change",callback).on("keyup",self._debounce(callback,debounceTimeout));if(self.options.hide){input.one("focus",function(){self.show()})}}})})(jQuery);ColorPickerControl=AbstractControl.extend({addSerializedData:function(data){data.rgba=this.model.get("rgba");return data},onRender:function(){this.initWidgets();this.updateControlGroups()},onDefaultButtonChange:function(){this.restoreDefaults();this.destroyWidgets();this.render()},initWidgets:function(){var control=this;var defaults=this.getDefaults();var palettes=this.model.get("palettes");this.ui.input.each(function(){var $el=$(this);$el.wpColorPicker({palettes:palettes,defaultColor:defaults[this.name],change:function(){var color=control.ui.input.wpColorPicker("color");if("undefined"==typeof control.getValue()&&""==color){return}control.setValue($el.wpColorPicker("color"))},clear:function(){control.setValue("")}})})},destroyWidgets:function(){this.ui.input.each(function(){$(this).wpColorPicker("close")})},onBeforeDestroy:function(){this.destroyWidgets()}});module.exports=ColorPickerControl},{"./abstract-control":12}],17:[function(require,module,exports){var AbstractControl=require("./abstract-control"),EditorControl;EditorControl=AbstractControl.extend({ui:{input:"textarea",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"blur @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"restoreDefaults"},getTemplate:function(){var html=document.getElementById("tmpl-tailor-control-editor").innerHTML;return _.template(html.replace(new RegExp("tailor-editor","gi"),"<%= media %>-<%= cid %>").replace(new RegExp("tailor-value","gi"),"<%= values[ media ] %>"))},addSerializedData:function(data){data.cid=this.cid;return data},addEventListeners:function(){this.listenTo(this.getSetting().collection,"change",this.checkDependencies)},maybeRefreshEditor:function(el){if(el.contains(this.el)){_.each(this.getValues(),function(value,media){tinyMCE.execCommand("mceRemoveEditor",false,media+"-"+this.cid);tinyMCE.execCommand("mceAddEditor",false,media+"-"+this.cid)},this)}},onAttach:function(){var control=this;_.each(this.getValues(),function(value,media){var id=media+"-"+control.cid;var quickTagSettings=_.extend({},tinyMCEPreInit.qtInit["tailor-editor"],{id:id});quicktags(quickTagSettings);QTags._buttonsInit();tinyMCEPreInit.mceInit[id]=_.extend({},tinyMCEPreInit.mceInit["tailor-editor"],{id:id,resize:"vertical",height:350,setup:function(ed){ed.on("change",function(){ed.save();control.setValue(ed.getContent())})}});switchEditors.go(id,"tmce");tinymce.execCommand("mceAddEditor",true,id)},this)},restoreDefaults:function(){_.each(this.getSettings(),function(setting){var value=setting.get("default")||"";setting.set("value",value);var editor=tinyMCE.get(setting.media+"-"+this.cid);editor.setContent(value)},this)},onDestroy:function(){_.each(this.getValues(),function(value,media){tinyMCE.execCommand("mceRemoveEditor",true,media+"-"+this.cid)},this)}});module.exports=EditorControl},{"./abstract-control":12}],18:[function(require,module,exports){var AbstractControl=require("./abstract-control"),GalleryControl;GalleryControl=AbstractControl.extend({ui:{select:".button--select",change:".button--change",remove:".button--remove",thumbnails:".thumbnails",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.select":"selectImages","click @ui.change":"selectImages","click @ui.remove":"removeImages","click @ui.thumbnails":"selectImages","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},addSerializedData:function(data){data.ids={};_.each(data.values,function(value,media){data.ids[media]=this.getIds(value)},this);return data},selectImages:function(){_.each(this.getValues(),function(value,media){if(media==this.media){var control=this;var ids=control.getIds(value);var selection=this.getSelection(ids);var frame=wp.media({frame:"post",state:ids.length?"gallery-edit":"gallery-library",editing:true,multiple:true,selection:selection});var library;frame.on("open",function(){var mediaFrame=frame.views.get(".media-frame-menu")[0];mediaFrame.$el.children().slice(0,2).hide();library=JSON.stringify(selection.toJSON())}).on("update",function(collection){var value=collection.pluck("id").join(",");control.setValue(value);if(!_.isEqual(library,JSON.stringify(collection.toJSON()))){var setting=control.getSetting(media);setting.trigger("change",setting,value)}}).on("close",function(){frame.dispose()});frame.open()}},this)},getIds:function(value){if(_.isEmpty(value)){return false}return value.split(",")},removeImages:function(){this.setValue("")},onSettingChange:function(){this.render()},onRender:function(){var control=this;_.each(this.getValues(),function(value,media){var selection=this.getSelection(control.getIds(value));selection.more().done(function(){selection.props.set({query:false});selection.unmirror();selection.props.unset("orderby");control.updateThumbnails(selection,media)})},this);this.updateControlGroups()},updateThumbnails:function(selection,media){var html="";var urls=selection.map(function(attachment){var sizes=attachment.get("sizes");var url;if(sizes.hasOwnProperty("medium")){url=sizes.medium.url}else if(sizes.hasOwnProperty("thumbnail")){url=sizes.thumbnail.url}else if(sizes.hasOwnProperty("full")){url=sizes.full.url}else{url=""}return url});if(urls.length){_.each(urls,function(url){html+='
  • '})}this.ui.controlGroups.filter('[id^="'+media+'"]').find(".thumbnails").removeClass("is-loading").html(html)},getSelection:function(ids){var attachments=wp.media.query({orderby:"post__in",order:"ASC",type:"image",post__in:ids});return new wp.media.model.Selection(attachments.models,{props:attachments.props.toJSON(),multiple:true})}});module.exports=GalleryControl},{"./abstract-control":12}],19:[function(require,module,exports){var $=Backbone.$,AbstractControl=require("./abstract-control"),IconControl;IconControl=AbstractControl.extend({ui:{select:".button--select",change:".button--change",remove:".button--remove",icon:"i",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.select":"openDialog","click @ui.change":"openDialog","click @ui.remove":"removeIcon","click @ui.icon":"openDialog","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},openDialog:function(){var control=this;var options={title:"Select Icon",button:window._l10n.select,content:function(){var kits=window._kits||{};var value=control.getValue();if(_.keys(kits).length){return _.template(document.getElementById("tmpl-tailor-control-icon-select").innerHTML)({kits:kits,value:value})}return document.getElementById("tmpl-tailor-control-icon-empty").innerHTML},onOpen:function(){var $el=this.$el;var $li=$el.find("li");var $kits=$el.find(".icon-kit");this.$el.find(".search--icon").on("input",function(e){var term=this.value.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");term=term.replace(/ /g,")(?=.*");var match=new RegExp("^(?=.*"+term+").+","i");$li.each(function(){this.classList.toggle("is-hidden",!match.test(this.getAttribute("title")))})});this.$el.find(".select--icon").on("change",function(e){var kit=this.value;$kits.removeClass("is-hidden").filter(function(){return this.id!=kit}).addClass("is-hidden")})},onValidate:function(){return $("input[name=icon]:checked").val()},onSave:function(){control.setValue($("input[name=icon]:checked").val())},onClose:function(){this.$el.find(".search--icon").off("input")}};app.channel.trigger("dialog:open",options)},onSettingChange:function(){this.render()},removeIcon:function(){this.setValue("")}});module.exports=IconControl},{"./abstract-control":12}],20:[function(require,module,exports){var AbstractControl=require("./abstract-control"),ImageControl;ImageControl=AbstractControl.extend({ui:{select:".button--select",change:".button--change",remove:".button--remove",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *",thumbnail:".thumbnail"},events:{"click @ui.select":"openFrame","click @ui.change":"openFrame","click @ui.remove":"removeImage","click @ui.thumbnail":"openFrame","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},initialize:function(options){this.frame=wp.media({states:[new wp.media.controller.Library({title:"Select Image",library:wp.media.query({type:["image"]}),multiple:false,date:false})]});this.addEventListeners();this.checkDependencies()},addEventListeners:function(){_.each(this.getSettings(),function(setting){this.listenTo(setting,"change",this.onSettingChange)},this);this.listenTo(this.getSetting().collection,"change",this.checkDependencies);this.frame.on("select",this.selectImage.bind(this))},openFrame:function(){this.frame.open()},selectImage:function(){var selection=this.frame.state().get("selection");var attachment=selection.first();var sizes=attachment.get("sizes");this.setValue(attachment.get("id"))},updateThumbnail:function(sizes,media){var url;if(sizes.hasOwnProperty("medium")){url=sizes.medium.url}else if(sizes.hasOwnProperty("thumbnail")){url=sizes.thumbnail.url}else if(sizes.hasOwnProperty("full")){url=sizes.full.url}else{return}this.ui.controlGroups.filter('[id^="'+media+'"]').find(".thumbnails").removeClass("is-loading").html('
  • ')},removeImage:function(){this.setValue("")},onSettingChange:function(){this.render()},onRender:function(){_.each(this.getValues(),function(value,media){if(value){var attachment=wp.media.attachment(value);var sizes=attachment.get("sizes");if(sizes){this.updateThumbnail(sizes,media)}else{var control=this;attachment.fetch({success:function(){sizes=attachment.get("sizes");control.updateThumbnail(sizes,media)}})}}},this);this.updateControlGroups()},onDestroy:function(){this.frame.off().dispose()}});module.exports=ImageControl},{"./abstract-control":12}],21:[function(require,module,exports){var AbstractControl=require("./abstract-control"),InputGroup;InputGroup=AbstractControl.extend({addSerializedData:function(data){data.choices=this.model.get("choices");data.values={};_.each(this.getValues(),function(value,media){data.values[media]={};var values=[];if(_.isString(value)){if(-1!=value.indexOf(",")){values=value.split(",")}else{values=value.split("-")}}var i=0;for(var choice in data.choices){if(data.choices.hasOwnProperty(choice)){data.values[media][choice]=values[i];i++}}});return data},onFieldChange:function(e){var fields=this.ui.input.filter('[name^="'+this.media+'"]').serializeArray();var values=_.map(fields,function(field){return field.value});this.setValue(values.join(","))}});module.exports=InputGroup},{"./abstract-control":12}],22:[function(require,module,exports){var $=Backbone.$,AbstractControl=require("./abstract-control"),LinkControl;LinkControl=AbstractControl.extend({ui:{input:"input",select:".button--select",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"blur @ui.input":"onFieldChange","click @ui.select":"openDialog","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},addSerializedData:function(data){data.placeholder=this.model.get("placeholder");return data},search:function(term){var control=this;var $searchResults=this.$el.find(".search-results");if($searchResults.length){control.$el.addClass("is-searching");var options={data:{s:term,nonce:window._nonces.query},success:function(response){$searchResults.html(response)},complete:function(){control.$el.removeClass("is-searching")}};window.ajax.send("tailor_get_links",options)}},openDialog:function(){var control=this;var options={title:"Select content",button:window._l10n.select,content:function(){return'
    '+''+''+'
    '+"
    "},onOpen:function(){var dialog=this;var previousTerm="";var minimumCharacters=3;var timeout;this.$el.find(".search--content").on("input",function(e){clearTimeout(timeout);var term=this.value;if(term.length>=minimumCharacters&&previousTerm!=$.trim(term)){timeout=setTimeout($.proxy(control.search,dialog,term),500)}})},onValidate:function(){return $("input[name=url]:checked").val()},onSave:function(){var url=$("input[name=url]:checked").val();control.setValue(url)},onClose:function(){this.$el.find(".search--content").off("input")}};app.channel.trigger("dialog:open",options)},onSettingChange:function(){this.render()}});module.exports=LinkControl},{"./abstract-control":12}],23:[function(require,module,exports){var EmptyListView=Marionette.ItemView.extend({template:"#tmpl-tailor-control-list-empty"});module.exports=EmptyListView},{}],24:[function(require,module,exports){var ListItemControl=Marionette.CompositeView.extend({tagName:"li",className:"list-item",ui:{title:".list-item__title",content:".list-item__content","delete":".js-delete-list-item",close:".js-close-list-item"},triggers:{"click @ui.title":"toggle","click @ui.close":"toggle","click @ui.delete":"delete"},events:{keypress:"onKeyPress"},getChildView:function(child){return Tailor.lookup(child.get("type"),false,"Controls")},childViewContainer:"#controls",template:"#tmpl-tailor-control-list-item",initialize:function(options){this.settings=options.settings;this._open=false;this.model.startTracking();this.addEventListeners()},addEventListeners:function(){this.listenTo(this.settings,"change",this.onChangeSettings);this.listenTo(app.channel,"modal:apply",this.onApplyModal);this.listenTo(app.channel,"modal:close",this.onCloseModal)},updateTitle:function(from,to){this.ui.title.find(":contains("+from+")").html(to)},onKeyPress:function(e){if(13===e.which){this.triggerMethod("toggle")}},onToggle:function(){if(this._open){this.slideUp()}else{this.slideDown()}},slideUp:function(){var control=this;control._open=false;control.ui.content.slideUp(150,function(){control.el.classList.remove("is-open")})},slideDown:function(){var control=this;control._open=true;control.ui.content.slideDown(150,function(){control.el.classList.add("is-open")})},onDelete:function(){var control=this;control.$el.slideUp(250,function(){control.triggerMethod("remove")})},onChangeSettings:function(setting){var atts=_.clone(this.model.get("atts"));var settingId=setting.get("id");var settingValue=setting.get("value");if("title"==settingId){this.updateTitle(atts.title,settingValue)}atts[settingId]=settingValue;this.model.set("atts",atts)},onApplyModal:function(){this.model.stopTracking()},onCloseModal:function(){this.model.resetAttributes()}});module.exports=ListItemControl},{}],25:[function(require,module,exports){var ListControl=Marionette.CompositeView.extend({childView:require("./list-item"),childViewContainer:"#list-items",emptyView:require("./list-empty"),className:function(){return"control control--"+this.model.get("type")},ui:{button:".js-add"},events:{"click @ui.button":"addItem"},collectionEvents:{add:"updateContent",remove:"updateContent",change:"updateContent"},childEvents:{remove:"deleteItem",toggle:"onToggleItem"},template:"#tmpl-tailor-control-list",serializeData:function(){var data=Backbone.Marionette.ItemView.prototype.serializeData.apply(this,arguments);data.childLabel=this.child.get("label").toLowerCase();return data},childViewOptions:function(model,index){var controlCollection=app.channel.request("sidebar:controls",model);var settingCollection=app.channel.request("sidebar:settings",model);var options={model:model,collection:controlCollection,settings:settingCollection};return options},initialize:function(options){this.element=options.element;this._added=[];this._deleted=[];var listItemDefinition=app.channel.request("sidebar:library",this.element.get("tag"));this.child=app.channel.request("sidebar:library",listItemDefinition.get("child"));this.addEventListeners()},addEventListeners:function(){this.listenTo(app.channel,"modal:apply",this.onApplyModal);this.listenTo(app.channel,"modal:close",this.onCloseModal)},filter:function(child,index,collection){return child.get("parent")==this.element.get("id")},onRender:function(){var listControl=this;this.sortable=Sortable.create(this.$childViewContainer.get(0),{draggable:".list-item",handle:".list-item__title",animation:250,onEnd:function(e){app.channel.trigger("list:change:order",listControl.el);listControl.updateOrder()}})},isEmpty:function(){return this.collection.getChildren(this.element).length==0},onToggleItem:function(child){this.children.each(function(childView){if(childView!==child){childView.slideUp()}},this)},onAddChild:function(child){this.children.each(function(childView){if(childView!==child){childView.slideUp()}},this)},addItem:function(){var numberChildren=this.collection.getChildren(this.element).length;var item=_.first(this.collection.create([{tag:this.child.get("tag"),parent:this.element.get("id"),order:numberChildren,atts:{title:this.child.get("label")}}],{}));this._added.push(item)},deleteItem:function(view){for(var i=0;i *"},events:{"input @ui.range":"onFieldChange","blur @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{inputAttrs:function(){var atts="";_.each(this.attrs,function(value,attr){atts+=attr+'="'+value+'"'});return atts}},addSerializedData:function(data){data.attrs=this.model.get("input_attrs");return data},onFieldChange:function(e){var value=e.target.value;this.ui.input.filter('[name^="'+this.media+'"]').val(value);this.ui.range.filter('[name^="'+this.media+'"]').val(value);this.setValue(value)}});module.exports=RangeControl},{"./abstract-control":12}],28:[function(require,module,exports){var AbstractControl=require("./abstract-control"),SelectMultiControl;SelectMultiControl=AbstractControl.extend({ui:{input:"select",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"change @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{selected:function(media,key){var values=this.values[media].split(",");return-1!==values.indexOf(key)?"selected":""}},onRender:function(){_.each(this.getValues(),function(value,media){var $field=this.ui.input.filter('[name^="'+media+'"]');$field.select2()},this);this.updateControlGroups()},onFieldChange:function(){var $field=this.ui.input.filter('[name^="'+this.media+'"]');var field=$field.get(0);var values=[];for(var i=0;i *"},events:{"change @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{selected:function(media,key){return key===this.values[media]?"selected":""}}});module.exports=SelectControl},{"./abstract-control":12}],30:[function(require,module,exports){var $=window.jQuery,AbstractControl=require("./abstract-control"),StyleControl;StyleControl=AbstractControl.extend({linked:true,ui:{input:"input",mediaButton:".js-setting-group .button",defaultButton:".js-default",linkButton:".js-link",controlGroups:".control__body > *"},events:{"input @ui.input":"updateLinkedFields","blur @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange","click @ui.linkButton":"onLinkButtonChange"},addSerializedData:function(data){data.choices=this.model.get("choices");data.values={};_.each(this.getValues(),function(value,media){data.values[media]={};var values=[];if(_.isString(value)){if(-1!=value.indexOf(",")){values=value.split(",")}else{values=value.split("-")}}var i=0;for(var choice in data.choices){if(data.choices.hasOwnProperty(choice)){data.values[media][choice]=values[i];i++}}});return data},onRender:function(){ +})}});module.exports=AbstractControl},{}],13:[function(require,module,exports){var AbstractControl=require("./abstract-control"),ButtonGroupControl;ButtonGroupControl=AbstractControl.extend({ui:{input:".control__body .button",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{active:function(media,key){return key===this.values[media]?"active":""}},onFieldChange:function(e){this.ui.input.filter('[name^="'+this.media+'"]').removeClass("active");var button=e.currentTarget;button.classList.add("active");this.setValue(button.value)}});module.exports=ButtonGroupControl},{"./abstract-control":12}],14:[function(require,module,exports){var AbstractControl=require("./abstract-control"),CheckboxControl;CheckboxControl=AbstractControl.extend({events:{"change @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{checked:function(media,key){var values=this.values[media].split(",");return-1!==values.indexOf(key)?"checked":""}},onFieldChange:function(e){var values=[];_.each(this.ui.input.filter('[name^="'+this.media+'"]:checked'),function(field){if(field.checked){values.push(field.value||0)}});this.setValue(values.join(","))}});module.exports=CheckboxControl},{"./abstract-control":12}],15:[function(require,module,exports){var $=window.jQuery,AbstractControl=require("./abstract-control"),CodeControl;CodeControl=AbstractControl.extend({ui:{input:"textarea",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},addSerializedData:function(data){data.cid=this.cid;return data},onRender:function(){var control=this;var mode=control.model.get("mode");this.editors={};_.each(this.getValues(),function(value,media){var $field=control.ui.input.filter('[name^="'+media+"-"+control.cid+'"]');control.editors[media]=CodeMirror.fromTextArea($field.get(0),{mode:mode,lineNumbers:true,matchBrackets:true,continueComments:"Enter",viewportMargin:Infinity,extraKeys:{F11:function(cm){cm.setOption("fullScreen",!cm.getOption("fullScreen"))},Esc:function(cm){if(cm.getOption("fullScreen")){cm.setOption("fullScreen",false)}}}});control.editors[media].on("change",function(editor){control.setValue(editor.getValue())},this);setTimeout(function(){control.editors[media].refresh()},10)});this.updateControlGroups()},restoreDefaults:function(){_.each(this.getSettings(),function(setting,media){var value=setting.get("default")||"";setting.set("value",value)})},updateControlGroups:function(){var control=this;var media=this.media;this.ui.controlGroups.each(function(){$(this).toggleClass("is-hidden",media!=this.id)});this.ui.mediaButton.each(function(){$(this).toggleClass("active",media==this.getAttribute("data-media"))});control.editors[media].refresh()},onDestroy:function(){var control=this;_.each(this.getValues(),function(value,media){control.editors[media].off();control.editors[media].toTextArea()})}});module.exports=CodeControl},{"./abstract-control":12}],16:[function(require,module,exports){var $=window.jQuery,AbstractControl=require("./abstract-control"),ColorPickerControl;(function($){var image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==";var _before='
    ',_after='
    ',_wrap='
    ',_button='';Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var hex=parseInt(this._color,10).toString(16);if(this.error)return"";if(hex.length<6){for(var i=6-hex.length-1;i>=0;i--){hex="0"+hex}}return"#"+hex};$.widget("wp.wpColorPicker",$.wp.wpColorPicker,{_create:function(){if(!$.support.iris){return}var self=this,el=self.element;$.extend(self.options,el.data());self.close=$.proxy(self.close,self);self.initialValue=el.val();el.addClass("wp-color-picker").hide().wrap(_wrap);self.wrap=el.parent();self.toggler=$(_before).insertBefore(el).css({backgroundColor:self.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current);self.pickerContainer=$(_after).insertAfter(el);self.button=$(_button);if(self.options.defaultColor){self.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString)}else{self.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear)}el.wrap('').after(self.button);el.iris({target:self.pickerContainer,hide:self.options.hide,width:self.options.width,mode:self.options.mode,palettes:self.options.palettes,change:function(event,ui){if(self.options.rgba){self.toggler.css({"background-image":"url("+image+")"}).html("");self.toggler.find("span").css({width:"100%",height:"100%",position:"absolute",top:0,left:0,"border-top-left-radius":"3px","border-bottom-left-radius":"3px",background:ui.color.toString()})}else{self.toggler.css({backgroundColor:ui.color.toString()})}if($.isFunction(self.options.change)){self.options.change.call(this,event,ui)}}});el.val(self.initialValue);self._addListeners();if(!self.options.hide){self.toggler.click()}},_addListeners:function(){var self=this;self.wrap.on("click.wpcolorpicker",function(event){event.stopPropagation()});self.toggler.click(function(){if(self.toggler.hasClass("wp-picker-open")){self.close()}else{self.open()}});self.element.change(function(event){var me=$(this),val=me.val();if(val===""||self.element.hasClass("iris-error")){if(self.options.rgba){self.toggler.removeAttr("style");self.toggler.find("span").css("backgroundColor","")}else{self.toggler.css("backgroundColor","")}if($.isFunction(self.options.clear)){self.options.clear.call(this,event)}}});self.toggler.on("keyup",function(event){if(event.keyCode===13||event.keyCode===32){event.preventDefault();self.toggler.trigger("click").next().focus()}});self.button.click(function(event){var me=$(this);if(me.hasClass("wp-picker-clear")){self.element.val("");if(self.options.rgba){self.toggler.removeAttr("style");self.toggler.find("span").css("backgroundColor","")}else{self.toggler.css("backgroundColor","")}if($.isFunction(self.options.clear)){self.options.clear.call(this,event)}}else if(me.hasClass("wp-picker-default")){self.element.val(self.options.defaultColor).change()}})}});$.widget("a8c.iris",$.a8c.iris,{_create:function(){this._super();this.options.rgba=this.element.data("rgba")||false;if(!this.element.is(":input")){this.options.alpha=false}if(typeof this.options.rgba!=="undefined"&&this.options.rgba){var self=this,_html='
    ',aContainer=$(_html).appendTo(self.picker.find(".iris-picker-inner")),aSlider=aContainer.find(".iris-slider-offset-alpha"),controls={aContainer:aContainer,aSlider:aSlider};$.each(controls,function(k,v){self.controls[k]=v});self.controls.square.css({"margin-right":"0"});var emptyWidth=self.picker.width()-self.controls.square.width()-20,stripsMargin=emptyWidth/6,stripsWidth=emptyWidth/2-stripsMargin;$.each(["aContainer","strip"],function(k,v){self.controls[v].width(stripsWidth).css({"margin-left":stripsMargin+"px"})});self._initControls();self._change()}},_initControls:function(){this._super();if(this.options.rgba){var self=this,controls=self.controls;controls.aSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(self._color._alpha*100),slide:function(event,ui){self._color._alpha=parseFloat(ui.value/100);self._change.apply(self,arguments)}})}},_change:function(){this._super();var self=this,el=self.element;if(this.options.rgba){var controls=self.controls,alpha=parseInt(self._color._alpha*100),color=self._color.toRgb(),gradient=["rgb("+color.r+","+color.g+","+color.b+") 0%","rgba("+color.r+","+color.g+","+color.b+", 0) 100%"],defaultWidth=self.options.defaultWidth,customWidth=self.options.customWidth,target=self.picker.closest(".wp-picker-container").find(".wp-color-result");controls.aContainer.css({background:"linear-gradient(to bottom, "+gradient.join(", ")+"), url("+image+")"});if(target.hasClass("wp-picker-open")){controls.aSlider.slider("value",alpha);if(self._color._alpha<1){var style=controls.strip.attr("style").replace(/rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g,"rgb($1$3$5)");controls.strip.attr("style",style);el.width(parseInt(defaultWidth+customWidth))}else{el.width(defaultWidth)}}}var reset=el.data("reset-alpha")||false;if(reset){self.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){self._color._alpha=1;self.active="external";self._change()})}},_addInputListeners:function(input){var self=this,debounceTimeout=100,callback=function(event){var color=new Color(input.val()),val=input.val();input.removeClass("iris-error");if(color.error){if(val!==""){input.addClass("iris-error")}}else{if(color.toString()!==self._color.toString()){if(!(event.type==="keyup"&&val.match(/^[0-9a-fA-F]{3}$/))){self._setOption("color",color.toString())}}}};input.on("change",callback).on("keyup",self._debounce(callback,debounceTimeout));if(self.options.hide){input.one("focus",function(){self.show()})}}})})(jQuery);ColorPickerControl=AbstractControl.extend({addSerializedData:function(data){data.rgba=this.model.get("rgba");return data},onRender:function(){this.initWidgets();this.updateControlGroups()},onDefaultButtonChange:function(){this.restoreDefaults();this.destroyWidgets();this.render()},initWidgets:function(){var control=this;var defaults=this.getDefaults();var palettes=this.model.get("palettes");this.ui.input.each(function(){var $el=$(this);$el.wpColorPicker({palettes:palettes,defaultColor:defaults[this.name],change:function(){var color=control.ui.input.wpColorPicker("color");if("undefined"==typeof control.getValue()&&""==color){return}control.setValue($el.wpColorPicker("color"))},clear:function(){control.setValue("")}})})},destroyWidgets:function(){this.ui.input.each(function(){$(this).wpColorPicker("close")})},onBeforeDestroy:function(){this.destroyWidgets()}});module.exports=ColorPickerControl},{"./abstract-control":12}],17:[function(require,module,exports){var AbstractControl=require("./abstract-control"),EditorControl;EditorControl=AbstractControl.extend({ui:{input:"textarea",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"blur @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"restoreDefaults"},getTemplate:function(){var html=document.getElementById("tmpl-tailor-control-editor").innerHTML;return _.template(html.replace(new RegExp("tailor-editor","gi"),"<%= media %>-<%= cid %>").replace(new RegExp("tailor-value","gi"),"<%= values[ media ] %>"))},addSerializedData:function(data){data.cid=this.cid;return data},addEventListeners:function(){this.listenTo(this.getSetting().collection,"change",this.checkDependencies)},maybeRefreshEditor:function(el){if(el.contains(this.el)){_.each(this.getValues(),function(value,media){tinyMCE.execCommand("mceRemoveEditor",false,media+"-"+this.cid);tinyMCE.execCommand("mceAddEditor",false,media+"-"+this.cid)},this)}},onAttach:function(){var control=this;_.each(this.getValues(),function(value,media){var id=media+"-"+control.cid;var quickTagSettings=_.extend({},tinyMCEPreInit.qtInit["tailor-editor"],{id:id});quicktags(quickTagSettings);QTags._buttonsInit();tinyMCEPreInit.mceInit[id]=_.extend({},tinyMCEPreInit.mceInit["tailor-editor"],{id:id,resize:"vertical",height:350,setup:function(ed){ed.on("change",function(){ed.save();control.setValue(ed.getContent())})}});switchEditors.go(id,"tmce");tinymce.execCommand("mceAddEditor",true,id)},this)},restoreDefaults:function(){_.each(this.getSettings(),function(setting){var value=setting.get("default")||"";setting.set("value",value);var editor=tinyMCE.get(setting.media+"-"+this.cid);editor.setContent(value)},this)},onDestroy:function(){_.each(this.getValues(),function(value,media){tinyMCE.execCommand("mceRemoveEditor",true,media+"-"+this.cid)},this)}});module.exports=EditorControl},{"./abstract-control":12}],18:[function(require,module,exports){var AbstractControl=require("./abstract-control"),GalleryControl;GalleryControl=AbstractControl.extend({ui:{select:".button--select",change:".button--change",remove:".button--remove",thumbnails:".thumbnails",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.select":"selectImages","click @ui.change":"selectImages","click @ui.remove":"removeImages","click @ui.thumbnails":"selectImages","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},addSerializedData:function(data){data.ids={};_.each(data.values,function(value,media){data.ids[media]=this.getIds(value)},this);return data},selectImages:function(){_.each(this.getValues(),function(value,media){if(media==this.media){var control=this;var ids=control.getIds(value);var selection=this.getSelection(ids);var frame=wp.media({frame:"post",state:ids.length?"gallery-edit":"gallery-library",editing:true,multiple:true,selection:selection});var library;frame.on("open",function(){var mediaFrame=frame.views.get(".media-frame-menu")[0];mediaFrame.$el.children().slice(0,2).hide();library=JSON.stringify(selection.toJSON())}).on("update",function(collection){var value=collection.pluck("id").join(",");control.setValue(value);if(!_.isEqual(library,JSON.stringify(collection.toJSON()))){var setting=control.getSetting(media);setting.trigger("change",setting,value)}}).on("close",function(){frame.dispose()});frame.open()}},this)},getIds:function(value){if(_.isEmpty(value)){return false}return value.split(",")},removeImages:function(){this.setValue("")},onSettingChange:function(){this.render()},onRender:function(){var control=this;_.each(this.getValues(),function(value,media){var selection=this.getSelection(control.getIds(value));selection.more().done(function(){selection.props.set({query:false});selection.unmirror();selection.props.unset("orderby");control.updateThumbnails(selection,media)})},this);this.updateControlGroups()},updateThumbnails:function(selection,media){var html="";var urls=selection.map(function(attachment){var sizes=attachment.get("sizes");var url;if(sizes.hasOwnProperty("medium")){url=sizes.medium.url}else if(sizes.hasOwnProperty("thumbnail")){url=sizes.thumbnail.url}else if(sizes.hasOwnProperty("full")){url=sizes.full.url}else{url=""}return url});if(urls.length){_.each(urls,function(url){html+='
  • '})}this.ui.controlGroups.filter('[id^="'+media+'"]').find(".thumbnails").removeClass("is-loading").html(html)},getSelection:function(ids){var attachments=wp.media.query({orderby:"post__in",order:"ASC",type:"image",post__in:ids});return new wp.media.model.Selection(attachments.models,{props:attachments.props.toJSON(),multiple:true})}});module.exports=GalleryControl},{"./abstract-control":12}],19:[function(require,module,exports){var $=Backbone.$,AbstractControl=require("./abstract-control"),IconControl;IconControl=AbstractControl.extend({ui:{select:".button--select",change:".button--change",remove:".button--remove",icon:"i",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.select":"openDialog","click @ui.change":"openDialog","click @ui.remove":"removeIcon","click @ui.icon":"openDialog","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},openDialog:function(){var control=this;var options={title:"Select Icon",button:window._l10n.select,content:function(){var kits=window._kits||{};var value=control.getValue();if(_.keys(kits).length){return _.template(document.getElementById("tmpl-tailor-control-icon-select").innerHTML)({kits:kits,value:value})}return document.getElementById("tmpl-tailor-control-icon-empty").innerHTML},onOpen:function(){var $el=this.$el;var $li=$el.find("li");var $kits=$el.find(".icon-kit");this.$el.find(".search--icon").on("input",function(e){var term=this.value.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");term=term.replace(/ /g,")(?=.*");var match=new RegExp("^(?=.*"+term+").+","i");$li.each(function(){this.classList.toggle("is-hidden",!match.test(this.getAttribute("title")))})});this.$el.find(".select--icon").on("change",function(e){var kit=this.value;$kits.removeClass("is-hidden").filter(function(){return this.id!=kit}).addClass("is-hidden")})},onValidate:function(){return $("input[name=icon]:checked").val()},onSave:function(){control.setValue($("input[name=icon]:checked").val())},onClose:function(){this.$el.find(".search--icon").off("input")}};app.channel.trigger("dialog:open",options)},onSettingChange:function(){this.render()},removeIcon:function(){this.setValue("")}});module.exports=IconControl},{"./abstract-control":12}],20:[function(require,module,exports){var AbstractControl=require("./abstract-control"),ImageControl;ImageControl=AbstractControl.extend({ui:{select:".button--select",change:".button--change",remove:".button--remove",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *",thumbnail:".thumbnail"},events:{"click @ui.select":"openFrame","click @ui.change":"openFrame","click @ui.remove":"removeImage","click @ui.thumbnail":"openFrame","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},initialize:function(options){this.frame=wp.media({states:[new wp.media.controller.Library({title:"Select Image",library:wp.media.query({type:["image"]}),multiple:false,date:false})]});this.addEventListeners();this.checkDependencies()},addEventListeners:function(){_.each(this.getSettings(),function(setting){this.listenTo(setting,"change",this.onSettingChange)},this);this.listenTo(this.getSetting().collection,"change",this.checkDependencies);this.frame.on("select",this.selectImage.bind(this))},openFrame:function(){this.frame.open()},selectImage:function(){var selection=this.frame.state().get("selection");var attachment=selection.first();var sizes=attachment.get("sizes");this.setValue(attachment.get("id"))},updateThumbnail:function(sizes,media){var url;if(sizes.hasOwnProperty("medium")){url=sizes.medium.url}else if(sizes.hasOwnProperty("thumbnail")){url=sizes.thumbnail.url}else if(sizes.hasOwnProperty("full")){url=sizes.full.url}else{return}this.ui.controlGroups.filter('[id^="'+media+'"]').find(".thumbnails").removeClass("is-loading").html('
  • ')},removeImage:function(){this.setValue("")},onSettingChange:function(){this.render()},onRender:function(){_.each(this.getValues(),function(value,media){if(value){var attachment=wp.media.attachment(value);var sizes=attachment.get("sizes");if(sizes){this.updateThumbnail(sizes,media)}else{var control=this;attachment.fetch({success:function(){sizes=attachment.get("sizes");control.updateThumbnail(sizes,media)}})}}},this);this.updateControlGroups()},onDestroy:function(){this.frame.off().dispose()}});module.exports=ImageControl},{"./abstract-control":12}],21:[function(require,module,exports){var AbstractControl=require("./abstract-control"),InputGroup;InputGroup=AbstractControl.extend({addSerializedData:function(data){data.choices=this.model.get("choices");data.values={};_.each(this.getValues(),function(value,media){data.values[media]={};var values=[];if(_.isString(value)){if(-1!=value.indexOf(",")){values=value.split(",")}else{values=value.split("-")}}var i=0;for(var choice in data.choices){if(data.choices.hasOwnProperty(choice)){data.values[media][choice]=values[i];i++}}});return data},onFieldChange:function(e){var fields=this.ui.input.filter('[name^="'+this.media+'"]').serializeArray();var values=_.map(fields,function(field){return field.value});this.setValue(values.join(","))}});module.exports=InputGroup},{"./abstract-control":12}],22:[function(require,module,exports){var $=Backbone.$,AbstractControl=require("./abstract-control"),LinkControl;LinkControl=AbstractControl.extend({ui:{input:"input",select:".button--select",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"blur @ui.input":"onFieldChange","click @ui.select":"openDialog","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},addSerializedData:function(data){data.placeholder=this.model.get("placeholder");return data},search:function(term){var control=this;var $searchResults=this.$el.find(".search-results");if($searchResults.length){control.$el.addClass("is-searching");var options={data:{s:term,nonce:window._nonces.query},success:function(response){$searchResults.html(response)},complete:function(){control.$el.removeClass("is-searching")}};window.ajax.send("tailor_get_links",options)}},openDialog:function(){var control=this;var options={title:"Select content",button:window._l10n.select,content:function(){return'
    '+''+''+'
    '+"
    "},onOpen:function(){var dialog=this;var previousTerm="";var minimumCharacters=3;var timeout;this.$el.find(".search--content").on("input",function(e){clearTimeout(timeout);var term=this.value;if(term.length>=minimumCharacters&&previousTerm!=$.trim(term)){timeout=setTimeout($.proxy(control.search,dialog,term),500)}})},onValidate:function(){return $("input[name=url]:checked").val()},onSave:function(){var url=$("input[name=url]:checked").val();control.setValue(url)},onClose:function(){this.$el.find(".search--content").off("input")}};app.channel.trigger("dialog:open",options)},onSettingChange:function(){this.render()}});module.exports=LinkControl},{"./abstract-control":12}],23:[function(require,module,exports){var EmptyListView=Marionette.ItemView.extend({template:"#tmpl-tailor-control-list-empty"});module.exports=EmptyListView},{}],24:[function(require,module,exports){var ListItemControl=Marionette.CompositeView.extend({tagName:"li",className:"list-item",ui:{title:".list-item__title",content:".list-item__content",delete:".js-delete-list-item",close:".js-close-list-item"},triggers:{"click @ui.title":"toggle","click @ui.close":"toggle","click @ui.delete":"delete"},events:{keypress:"onKeyPress"},getChildView:function(child){return Tailor.lookup(child.get("type"),false,"Controls")},childViewContainer:"#controls",template:"#tmpl-tailor-control-list-item",initialize:function(options){this.settings=options.settings;this._open=false;this.model.startTracking();this.addEventListeners()},addEventListeners:function(){this.listenTo(this.settings,"change",this.onChangeSettings);this.listenTo(app.channel,"modal:apply",this.onApplyModal);this.listenTo(app.channel,"modal:close",this.onCloseModal)},updateTitle:function(from,to){this.ui.title.find(":contains("+from+")").html(to)},onKeyPress:function(e){if(13===e.which){this.triggerMethod("toggle")}},onToggle:function(){if(this._open){this.slideUp()}else{this.slideDown()}},slideUp:function(){var control=this;control._open=false;control.ui.content.slideUp(150,function(){control.el.classList.remove("is-open")})},slideDown:function(){var control=this;control._open=true;control.ui.content.slideDown(150,function(){control.el.classList.add("is-open")})},onDelete:function(){var control=this;control.$el.slideUp(250,function(){control.triggerMethod("remove")})},onChangeSettings:function(setting){var atts=_.clone(this.model.get("atts"));var settingId=setting.get("id");var settingValue=setting.get("value");if("title"==settingId){this.updateTitle(atts.title,settingValue)}atts[settingId]=settingValue;this.model.set("atts",atts)},onApplyModal:function(){this.model.stopTracking()},onCloseModal:function(){this.model.resetAttributes()}});module.exports=ListItemControl},{}],25:[function(require,module,exports){var ListControl=Marionette.CompositeView.extend({childView:require("./list-item"),childViewContainer:"#list-items",emptyView:require("./list-empty"),className:function(){return"control control--"+this.model.get("type")},ui:{button:".js-add"},events:{"click @ui.button":"addItem"},collectionEvents:{add:"updateContent",remove:"updateContent",change:"updateContent"},childEvents:{remove:"deleteItem",toggle:"onToggleItem"},template:"#tmpl-tailor-control-list",serializeData:function(){var data=Backbone.Marionette.ItemView.prototype.serializeData.apply(this,arguments);data.childLabel=this.child.get("label").toLowerCase();return data},childViewOptions:function(model,index){var controlCollection=app.channel.request("sidebar:controls",model);var settingCollection=app.channel.request("sidebar:settings",model);var options={model:model,collection:controlCollection,settings:settingCollection};return options},initialize:function(options){this.element=options.element;this._added=[];this._deleted=[];var listItemDefinition=app.channel.request("sidebar:library",this.element.get("tag"));this.child=app.channel.request("sidebar:library",listItemDefinition.get("child"));this.addEventListeners()},addEventListeners:function(){this.listenTo(app.channel,"modal:apply",this.onApplyModal);this.listenTo(app.channel,"modal:close",this.onCloseModal)},filter:function(child,index,collection){return child.get("parent")==this.element.get("id")},onRender:function(){var listControl=this;this.sortable=Sortable.create(this.$childViewContainer.get(0),{draggable:".list-item",handle:".list-item__title",animation:250,onEnd:function(e){app.channel.trigger("list:change:order",listControl.el);listControl.updateOrder()}})},isEmpty:function(){return this.collection.getChildren(this.element).length==0},onToggleItem:function(child){this.children.each(function(childView){if(childView!==child){childView.slideUp()}},this)},onAddChild:function(child){this.children.each(function(childView){if(childView!==child){childView.slideUp()}},this)},addItem:function(){var numberChildren=this.collection.getChildren(this.element).length;var item=_.first(this.collection.create([{tag:this.child.get("tag"),parent:this.element.get("id"),order:numberChildren,atts:{title:this.child.get("label")}}],{}));this._added.push(item)},deleteItem:function(view){for(var i=0;i *"},events:{"input @ui.range":"onFieldChange","blur @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{inputAttrs:function(){var atts="";_.each(this.attrs,function(value,attr){atts+=attr+'="'+value+'"'});return atts}},addSerializedData:function(data){data.attrs=this.model.get("input_attrs");return data},onFieldChange:function(e){var value=e.target.value;this.ui.input.filter('[name^="'+this.media+'"]').val(value);this.ui.range.filter('[name^="'+this.media+'"]').val(value);this.setValue(value)}});module.exports=RangeControl},{"./abstract-control":12}],28:[function(require,module,exports){var AbstractControl=require("./abstract-control"),SelectMultiControl;SelectMultiControl=AbstractControl.extend({ui:{input:"select",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"change @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{selected:function(media,key){var values=this.values[media].split(",");return-1!==values.indexOf(key)?"selected":""}},onRender:function(){_.each(this.getValues(),function(value,media){var $field=this.ui.input.filter('[name^="'+media+'"]');$field.select2()},this);this.updateControlGroups()},onFieldChange:function(){var $field=this.ui.input.filter('[name^="'+this.media+'"]');var field=$field.get(0);var values=[];for(var i=0;i *"},events:{"change @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{selected:function(media,key){return key===this.values[media]?"selected":""}}});module.exports=SelectControl},{"./abstract-control":12}],30:[function(require,module,exports){var $=window.jQuery,AbstractControl=require("./abstract-control"),StyleControl;StyleControl=AbstractControl.extend({linked:true,ui:{input:"input",mediaButton:".js-setting-group .button",defaultButton:".js-default",linkButton:".js-link",controlGroups:".control__body > *"},events:{"input @ui.input":"updateLinkedFields","blur @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange","click @ui.linkButton":"onLinkButtonChange"},addSerializedData:function(data){data.choices=this.model.get("choices");data.values={};_.each(this.getValues(),function(value,media){data.values[media]={};var values=[];if(_.isString(value)){if(-1!=value.indexOf(",")){values=value.split(",")}else{values=value.split("-")}}var i=0;for(var choice in data.choices){if(data.choices.hasOwnProperty(choice)){data.values[media][choice]=values[i];i++}}});return data},onRender:function(){ this.updateControlGroups();this.updateLinkButton()},onLinkButtonChange:function(){this.linked=!this.linked;this.updateLinkButton()},onFieldChange:function(e){var fields=this.ui.input.filter('[name^="'+this.media+'"]').serializeArray();var values=_.map(fields,function(field){return field.value});this.setValue(values.join(","))},updateLinkButton:function(){this.ui.linkButton.toggleClass("is-active",this.linked)},updateLinkedFields:function(e){if(this.linked){this.ui.input.filter('[name^="'+this.media+'"]').filter(function(i,el){return el!=e.currentTarget}).val(e.currentTarget.value)}}});module.exports=StyleControl},{"./abstract-control":12}],31:[function(require,module,exports){var AbstractControl=require("./abstract-control"),SwitchControl;SwitchControl=AbstractControl.extend({events:{"change @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{checked:function(media){return 1==parseInt(this.values[media],10)?"checked":""}},onFieldChange:function(){var $field=this.ui.input.filter('[name^="'+this.media+'"]');this.setValue($field.get(0).checked?"1":"0")}});module.exports=SwitchControl},{"./abstract-control":12}],32:[function(require,module,exports){var AbstractControl=require("./abstract-control"),TextControl;TextControl=AbstractControl.extend({templateHelpers:{inputAttrs:function(){var atts="";_.each(this.attrs,function(value,attr){atts+=attr+'="'+value+'"'});return atts}},addSerializedData:function(data){data.attrs=this.model.get("input_attrs");return data}});module.exports=TextControl},{"./abstract-control":12}],33:[function(require,module,exports){var AbstractControl=require("./abstract-control"),TextareaControl;TextareaControl=AbstractControl.extend({ui:{input:"textarea",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"}});module.exports=TextareaControl},{"./abstract-control":12}],34:[function(require,module,exports){var $=Backbone.$,AbstractControl=require("./abstract-control"),VideoControl;VideoControl=AbstractControl.extend({ui:{select:".button--select",enterUrl:".button--enter",change:".button--change",remove:".button--remove",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.select":"openFrame","click @ui.enterUrl":"openDialog","click @ui.change":"openFrame","click @ui.remove":"removeVideo","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},initialize:function(options){this.frame=wp.media({states:[new wp.media.controller.Library({title:"Select Video",library:wp.media.query({type:["video"]}),multiple:false,date:false})]});this.addEventListeners();this.checkDependencies()},addEventListeners:function(){_.each(this.getSettings(),function(setting){this.listenTo(setting,"change",this.onSettingChange)},this);this.listenTo(this.getSetting().collection,"change",this.checkDependencies);this.frame.on("select",this.selectVideo.bind(this))},openFrame:function(){this.frame.open()},selectVideo:function(){var selection=this.frame.state().get("selection");var attachment=selection.first();this.setValue(attachment.get("id"))},openDialog:function(){var control=this;var options={title:"Enter URL",button:window._l10n.select,content:function(){return'
    '+''+"
    "},onValidate:function(){var url=$(".search--content").val();return url&&/^(ftp|http|https):\/\/[^ "]+$/.test(url)},onSave:function(){control.setValue($(".search--content").val())},onClose:function(){this.$el.find(".search--content").off("input")}};app.channel.trigger("dialog:open",options)},onSettingChange:function(){this.render()},removeVideo:function(){this.setValue("")},onRender:function(){var control=this;_.each(this.getValues(),function(value,media){if(value){var attachment=wp.media.attachment(value);if(!attachment.get("url")){attachment.fetch({success:function(){control.updatePreview(attachment,media)}})}else{control.updatePreview(attachment,media)}}},this);this.updateControlGroups()},updatePreview:function(attachment,media){var url=attachment.get("url");var mime=attachment.get("mime");this.ui.controlGroups.filter('[id^="'+media+'"]').find(".video-preview").removeClass("is-loading").html('')},onDestroy:function(){this.frame.dispose()}});module.exports=VideoControl},{"./abstract-control":12}],35:[function(require,module,exports){var $=window.jQuery,AbstractControl=require("./abstract-control"),WidgetFormControl;WidgetFormControl=AbstractControl.extend({ui:{},events:{"blur *":"onFieldChange","change *":"onFieldChange"},getTemplateId:function(){return"tmpl-tailor-widget-form-"+this.model.get("widget_id_base")},getTemplate:function(){var el=document.getElementById(this.getTemplateId());var template="";if(el){template=_.template(el.innerHTML)}return template},onRender:function(){var idBase=this.model.get("widget_id_base");var $el=this.$el;this.$el.find("label").addClass("control__title").each(function(){var $label=$(this);$label.html(this.innerHTML.replace(":",""))});_.each(this.getValues(),function(value,media){if(!_.isEmpty(value)){var values=JSON.parse(value);_.each(values,function(value,name){var $field=$el.find('[name="widget-'+idBase+"[__i__]["+name+']"]');if($field.length){if("checkbox"==$field[0].type||"radio"==$field[0].type){$field.attr("checked","true")}else{$field.val(value)}}})}},this)},onFieldChange:function(e){var fields=this.$el.find("input, select, radio, textarea").serializeArray();var values={};$.each(fields,function(){var matches=this.name.match(/\[(.*?)\]/g);if(matches&&2==matches.length){var name=matches[1].substring(1,matches[1].length-1);if("undefined"!=typeof values[name]){if(!values[name].push){values[name]=[values[name]]}values[name].push(this.value||"")}else{values[name]=this.value||""}}});this.setValue(JSON.stringify(values));e.preventDefault();e.stopImmediatePropagation()},onSettingChange:function(){}});module.exports=WidgetFormControl},{"./abstract-control":12}],36:[function(require,module,exports){var DefaultPanel=Marionette.CompositeView.extend({ui:{backButton:".back-button"},triggers:{"click @ui.backButton":"back:home"},behaviors:{Panel:{}},emptyView:Tailor.Panels.Empty,emptyViewOptions:function(){return{type:this.model.get("type")}},childViewContainer:"#items",getChildView:function(){return Tailor.lookup(this.model.get("type"),false,"Items")},filter:function(child,index,collection){switch(this.model.get("type")){case"library":return!_.contains(["tailor_row"],child.get("tag"))&&"child"!=child.get("type");break;case"default":return child.get("panel")===this.model.get("id");break;default:return true;break}},getTemplate:function(){var type=this.model.get("type")||"default";return"#tmpl-tailor-panel-"+type},serializeData:function(){var data=Marionette.ItemView.prototype.serializeData.apply(this,arguments);data.items=this.collection;return data},onShow:function(){this.ui.backButton.get(0).focus()}});module.exports=DefaultPanel},{}],37:[function(require,module,exports){var EmptyPanelView=Marionette.ItemView.extend({className:"empty",initialize:function(options){this.type=options.type},getTemplate:function(){var type=this.type||"default";return"#tmpl-tailor-panel-"+type+"-empty"}});module.exports=EmptyPanelView},{}],38:[function(require,module,exports){var DefaultSection=Marionette.CompositeView.extend({ui:{backButton:".back-button"},triggers:{"click @ui.backButton":"back:panel"},behaviors:{Panel:{}},emptyView:require("./section-empty"),childViewContainer:"#controls",initialize:function(options){this.panel=options.panel},getChildView:function(child){return Tailor.lookup(child.get("type"),false,"Controls")},filter:function(child,index,collection){if("default"===this.model.get("type")){return child.get("section")===this.model.get("id")}return true},getTemplate:function(){return"#tmpl-tailor-section-"+this.model.get("type")},serializeData:function(){var data=Marionette.ItemView.prototype.serializeData.apply(this,arguments);data.panel=this.panel.get("title");return data},onShow:function(){this.ui.backButton.get(0).focus()}});module.exports=DefaultSection},{"./section-empty":39}],39:[function(require,module,exports){var EmptySectionView=Marionette.ItemView.extend({className:"empty",getTemplate:function(){var type=this.model.get("type")||"default";return"#tmpl-tailor-section-"+type+"-empty"}});module.exports=EmptySectionView},{}],40:[function(require,module,exports){var ControlCollection=Backbone.Collection.extend({model:require("../models/control"),initialize:function(models,options){if(options&&options.settings){this.settings=options.settings}this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"reset",this.onReset)},onReset:function(){var mediaQueries=[];for(var mediaQueryId in _media_queries){if(_media_queries.hasOwnProperty(mediaQueryId)&&""!=_media_queries[mediaQueryId].max){mediaQueries.push(mediaQueryId)}}this.each(function(model){var settingId=model.get("setting");model.settings=this.settings.filter(function(setting){var id=setting.get("id");if(id==settingId){setting.media="desktop";return true}else{var index=_.indexOf(mediaQueries,id.replace(settingId+"_",""));if(-1!==index){setting.media=mediaQueries[index];return true}}return false})},this)}});module.exports=ControlCollection},{"../models/control":48}],41:[function(require,module,exports){var SearchableCollection=require("./searchable"),LibraryCollection;LibraryCollection=SearchableCollection.extend({model:function(attrs,options){var Model=Tailor.lookup(attrs.tag,attrs.type,"Models");return new Model(attrs,options)},comparator:"label",getHaystack:function(model){return[model.get("label"),model.get("type"),model.get("description"),model.get("badge"),model.get("tag")].join(" ")}});module.exports=LibraryCollection},{"./searchable":43}],42:[function(require,module,exports){var PanelCollection=Backbone.Collection.extend({model:require("../models/panel")});module.exports=PanelCollection},{"../models/panel":52}],43:[function(require,module,exports){var $=Backbone.$,SearchableCollection;SearchableCollection=Backbone.Collection.extend({doSearch:function(value){if(this.terms===value){return}this.terms=value;if(this.terms.length>0){this.search(this.terms)}if(this.terms===""){this.each(function(item){item.set("match",true)})}},search:function(term){var match,haystack;term=term.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");term=term.replace(/ /g,")(?=.*");match=new RegExp("^(?=.*"+term+").+","i");this.each(function(item){haystack=this.getHaystack(item);item.set("match",match.test(haystack))},this)}});module.exports=SearchableCollection},{}],44:[function(require,module,exports){var SectionCollection=Backbone.Collection.extend({model:require("../models/section")});module.exports=SectionCollection},{"../models/section":53}],45:[function(require,module,exports){var SettingCollection=Backbone.Collection.extend({model:require("../models/setting"),initialize:function(models,options){if(options&&options.element){this.element=options.element}this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"reset",this.load)},load:function(){var atts=this.element.get("atts");this.each(function(model){model.set("value",atts[model.get("id")])},this)}});module.exports=SettingCollection},{"../models/setting":54}],46:[function(require,module,exports){var SnapshotCollection=Backbone.Collection.extend({maxSize:50,active:null,comparator:function(model){return-model.get("timestamp")},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"add",this.checkLength);this.listenToOnce(app.channel,"canvas:initialize",function(){this.elements=app.channel.request("canvas:elements");this.save(window._l10n.initialized)})},save:function(label){if(this.active){var activePosition=this.indexOf(this.active);if(activePosition>0){this.remove(this.slice(0,activePosition))}}var entry=this.add({label:label||"",elements:this.elements?this.elements.toJSON():[],time:this.getTime(),timestamp:_.now()});this.setActive(entry)},getTime:function(){var date=new Date;var hours=date.getHours();var separator=":";var suffix;if(hours>12){hours-=12;suffix=" PM"}else{suffix=" AM"}return hours+separator+("0"+date.getMinutes()).slice(-2)+separator+("0"+date.getSeconds()).slice(-2)+suffix},restore:function(timestamp){var entry=this.findWhere({timestamp:timestamp});if(!entry||entry===this.getActive()){return}this.setActive(entry);var elements=entry.get("elements");app.channel.trigger("elements:reset",elements)},undo:function(){if(!this.length){return}var entry=this.at(this.indexOf(this.getActive())+1);if(entry){this.restore(entry.get("timestamp"))}},redo:function(){if(!this.length){return}var entry=this.at(this.indexOf(this.getActive())-1);if(entry){this.restore(entry.get("timestamp"))}},checkLength:function(){if(this.length>this.maxSize){this.pop()}},setActive:function(model){this.active=model;this.trigger("change:active",model)},getActive:function(){return this.active}});module.exports=SnapshotCollection},{}],47:[function(require,module,exports){var SearchableCollection=require("./searchable"),TemplateCollection;TemplateCollection=SearchableCollection.extend({model:require("../models/template"),comparator:"name",getHaystack:function(model){return[model.get("id"),model.get("label")].join(" ")}});module.exports=TemplateCollection},{"../models/template":55,"./searchable":43}],48:[function(require,module,exports){var ControlModel=Backbone.Model.extend({defaults:{id:"",label:"",description:"",type:"",choices:{},priority:0,setting:"",section:""}});module.exports=ControlModel},{}],49:[function(require,module,exports){var ContainerModel=Backbone.Model.extend({defaults:function(){return{label:"",description:"",tag:"",icon:"",sections:[],controls:[],type:"default",child:"",collection:"library"}},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:add:top",this.insertBefore);this.listenTo(this,"element:add:bottom",this.insertAfter);this.listenTo(this,"element:add:left",this.columnBefore);this.listenTo(this,"element:add:right",this.columnAfter)},insertBefore:function(view){this.insertAtIndex(view.model,view.model.get("order"))},insertAfter:function(view){this.insertAtIndex(view.model,view.model.get("order")+1)},insertAtIndex:function(model,index){var tag="tailor_content";var children=model.collection.create([{tag:tag,atts:{}},{tag:tag,atts:{}}],{silent:true});model.collection.createContainer(this,model.get("parent"),index,children)},columnBefore:function(view){var parentId=view.model.get("parent");var tag="tailor_content";var children;if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,view.model.get("order")-1);children=view.model.collection.create([{tag:tag,atts:{}},{tag:tag,atts:{}}],{silent:true});view.model.collection.createContainer(this,column.get("id"),0,children)}else{var columns=view.model.collection.createRow(parentId,view.model.get("order"));view.model.collection.insertChild(view.model,_.last(columns));children=view.model.collection.create([{tag:tag,atts:{}},{tag:tag,atts:{}}],{silent:true});view.model.collection.createContainer(this,_.first(columns).get("id"),0,children)}},columnAfter:function(view){var parentId=view.model.get("parent");var tag="tailor_content";var children;if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,view.model.get("order"));children=view.model.collection.create([{tag:tag,atts:{}},{tag:tag,atts:{}}],{silent:true});view.model.collection.createContainer(this,column.get("id"),0,children)}else{var columns=view.model.collection.createRow(parentId,view.model.get("order"));view.model.collection.insertChild(view.model,_.first(columns));children=view.model.collection.create([{tag:tag,atts:{}},{tag:tag,atts:{}}],{silent:true});view.model.collection.createContainer(this,_.last(columns).get("id"),0,children)}}});module.exports=ContainerModel},{}],50:[function(require,module,exports){var WrapperModel=Backbone.Model.extend({defaults:function(){return{label:"",description:"",tag:"",icon:"",sections:[],controls:[],type:"default",child:"",collection:"library"}},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:add:top",this.insertBefore);this.listenTo(this,"element:add:bottom",this.insertAfter);this.listenTo(this,"element:add:left",this.columnBefore);this.listenTo(this,"element:add:right",this.columnAfter);this.listenTo(this,"element:add:center",this.createChild)},insertBefore:function(view){this.insertAtIndex(view.model,view.model.get("order")-1)},insertAfter:function(view){this.insertAtIndex(view.model,view.model.get("order"))},insertAtIndex:function(model,index){model.collection.createWrapper(this.get("tag"),model.get("parent"),index)},columnBefore:function(view){var parentId=view.model.get("parent");var index=view.model.get("order")-1;var tag="tailor_content";if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,index);view.model.collection.createWrapper(this.get("tag"),column.get("id"),0)}else{var columns=view.model.collection.createRow(parentId,index);view.model.collection.insertChild(view.model,_.last(columns));view.model.collection.createWrapper(this.get("tag"),_.first(columns).get("id"),0)}},columnAfter:function(view){var parentId=view.model.get("parent");var index=view.model.get("order");var tag="tailor_content";if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,index);view.model.collection.createWrapper(this.get("tag"),column.get("id"),0)}else{var columns=view.model.collection.createRow(parentId,index);view.model.collection.insertChild(view.model,_.first(columns));view.model.collection.createWrapper(this.get("tag"),_.last(columns).get("id"),0)}},createChild:function(view){var parentId=view.model.get("id");var childTag=view.model.get("child");var numberChildren=view.model.collection.where({parent:parentId,tag:childTag}).length;var wrapper=view.model.collection.createWrapper(childTag,parentId,numberChildren,false);view.model.collection.createWrapper(this.get("tag"),wrapper.get("id"),0)}});module.exports=WrapperModel},{}],51:[function(require,module,exports){var ElementModel=Backbone.Model.extend({defaults:function(){return{label:"",description:"",tag:"",icon:"",sections:[],controls:[],type:"default",child:"",collection:"library"}},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:add:top",this.insertBefore);this.listenTo(this,"element:add:bottom",this.insertAfter);this.listenTo(this,"element:add:left",this.columnBefore);this.listenTo(this,"element:add:right",this.columnAfter);this.listenTo(this,"element:add:center",this.createChild)},insertBefore:function(view){this.insertAtIndex(view.model,view.model.get("order")-1)},insertAfter:function(view){this.insertAtIndex(view.model,view.model.get("order"))},insertAtIndex:function(model,index){model.collection.create([{tag:this.get("tag"),label:this.get("label"),parent:model.get("parent"),type:this.get("type"),order:index}],{})},columnBefore:function(view){var parentId=view.model.get("parent");if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,view.model.get("order")-1);view.model.collection.create([{tag:this.get("tag"),label:this.get("label"),parent:column.get("id"),type:this.get("type"),order:0}],{at:0})}else{var columns=view.model.collection.createRow(parentId,view.model.get("order"));view.model.collection.create([{tag:this.get("tag"),label:this.get("label"),parent:_.first(columns).get("id"),type:this.get("type"),order:0}],{at:0});view.model.collection.insertChild(view.model,_.last(columns))}},columnAfter:function(view){var parentId=view.model.get("parent");if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,view.model.get("order"));view.model.collection.create([{tag:this.get("tag"),label:this.get("label"),parent:column.get("id"),type:this.get("type"),order:0}],{at:0})}else{var columns=view.model.collection.createRow(parentId,view.model.get("order"));view.model.collection.create([{tag:this.get("tag"),label:this.get("label"),parent:_.last(columns).get("id"),type:this.get("type"),order:0}],{at:0});view.model.collection.insertChild(view.model,_.first(columns))}},createChild:function(view){var parentId=view.model.get("id");var childTag=view.model.get("child");var numberChildren=view.model.collection.where({parent:parentId,tag:childTag}).length;var wrapper=view.model.collection.createWrapper(childTag,parentId,numberChildren,false);var child=view.model.collection.create([{tag:this.get("tag"),label:this.get("label"),parent:wrapper.get("id"),type:this.get("type"),order:0}],{at:0})}});module.exports=ElementModel},{}],52:[function(require,module,exports){var PanelModel=Backbone.Model.extend({defaults:{id:"",title:"",description:"",collection:"",priority:0}});module.exports=PanelModel},{}],53:[function(require,module,exports){var SectionModel=Backbone.Model.extend({defaults:{id:"",title:"",description:"",priority:0,panel:""}});module.exports=SectionModel},{}],54:[function(require,module,exports){var SettingModel=Backbone.Model.extend({defaults:{id:"",type:""}});module.exports=SettingModel},{}],55:[function(require,module,exports){var TemplateModel=Backbone.Model.extend({defaults:function(){return{id:this.cid,label:"",collection:"template"}},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:add:top",this.insertBefore);this.listenTo(this,"element:add:bottom",this.insertAfter);this.listenTo(this,"element:add:left",this.columnBefore);this.listenTo(this,"element:add:right",this.columnAfter);this.listenTo(this,"element:add:center",this.createChild)},createChild:function(view){var parentId=view.model.get("id");var childTag=view.model.get("child");var numberChildren=view.model.collection.where({parent:parentId,tag:childTag}).length;var wrapper=view.model.collection.createWrapper(childTag,parentId,numberChildren,false);app.channel.trigger("template:load",this,wrapper.get("id"),0)},columnBefore:function(view){var parentId=view.model.get("parent");if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,view.model.get("order")-1);app.channel.trigger("template:load",this,column.get("id"),0)}else{var columns=view.model.collection.createRow(parentId,view.model.get("order"));app.channel.trigger("template:load",this,_.first(columns).get("id"),0);view.model.collection.insertChild(view.model,_.last(columns))}},columnAfter:function(view){var parentId=view.model.get("parent");if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,view.model.get("order"));app.channel.trigger("template:load",this,column.get("id"),0)}else{var columns=view.model.collection.createRow(parentId,view.model.get("order"));app.channel.trigger("template:load",this,_.last(columns).get("id"),0);view.model.collection.insertChild(view.model,_.first(columns))}},insertBefore:function(view){app.channel.trigger("template:load",this,view.model.get("parent"),view.model.get("order")-1)},insertAfter:function(view){app.channel.trigger("template:load",this,view.model.get("parent"),view.model.get("order"))}});module.exports=TemplateModel},{}],56:[function(require,module,exports){var $=window.jQuery,DevicePreviewModule;DevicePreviewModule=Marionette.Module.extend({device:"desktop",onBeforeStart:function(){var module=this;var api={getDevice:function(){return module.device}};app.channel.reply("sidebar:device",api.getDevice)},onStart:function(){var module=this;this.$buttons=$(".tailor-sidebar .devices button");this.preview=document.querySelector(".tailor-preview");this.viewport=this.preview.querySelector(".tailor-preview__viewport");this.mediaQueries=window._media_queries;this.setActive(this.$buttons.get(0));this.addEventListeners();app.channel.trigger("module:devicePreview:ready",this)},addEventListeners:function(){this.$buttons.on("click",this.onDevicePreview.bind(this))},onDevicePreview:function(e){var button=e.target;var previous=this.$buttons.filter("[data-device='"+this.device+"']").get(0);this.setInactive(previous);this.setActive(button);this.device=button.getAttribute("data-device");this.preview.className="tailor-preview "+this.device+"-screens";if(this.mediaQueries.hasOwnProperty(this.device)&&this.mediaQueries[this.device].max){this.viewport.style.maxWidth=this.mediaQueries[this.device].max}else{this.viewport.style.maxWidth=""}},setActive:function(button){button.classList.add("is-active");button.setAttribute("aria-pressed","true")},setInactive:function(button){button.classList.remove("is-active");button.setAttribute("aria-pressed","false")}});module.exports=DevicePreviewModule},{}],57:[function(require,module,exports){var DialogRegion=Backbone.Marionette.Region.extend({initialize:function(){this.$overlay=jQuery('
    ')},onShow:function(view,region,options){this.el.classList.add("is-visible");this.$overlay.on("click",jQuery.proxy(this.empty,this)).appendTo("body")},onEmpty:function(view,region,options){this.el.classList.remove("is-visible");this.$overlay.off().detach()}});module.exports=DialogRegion},{}],58:[function(require,module,exports){var DialogView=require("./show/dialog"),DialogModule;DialogModule=Marionette.Module.extend({onStart:function(){var api={showDialog:function(options){app.dialog.show(new DialogView(options))}};this.listenTo(app.channel,"dialog:open",api.showDialog);app.channel.trigger("module:dialog:ready",this)}});module.exports=DialogModule},{"./show/dialog":59}],59:[function(require,module,exports){var $=window.jQuery,DialogView;DialogView=Backbone.Marionette.ItemView.extend({className:"dialog",defaults:{title:"",content:"",button:""},ui:{close:".js-close",content:".dialog__content",save:".js-save"},events:{input:"onChange",change:"onChange"},triggers:{"click @ui.close":"close","click @ui.save":"save"},template:"#tmpl-tailor-dialog",serializeData:function(){return{title:this.title,content:this.content,button:this.button}},initialize:function(options){this.title=options.title||this.defaults.title;this.content=options.content||this.defaults.content;this.button=options.button||this.defaults.button;this.callbacks={validate:options.onValidate,open:options.onOpen,save:options.onSave,close:options.onClose}},onBeforeRender:function(){if("function"==typeof this.content){this.content=this.content.call(this)}},onDomRefresh:function(){if("function"===typeof this.callbacks.open){this.callbacks.open.call(this)}this.validate()},onChange:function(){this.validate()},validate:function(){if("function"===typeof this.callbacks.validate){this.ui.save.prop("disabled",!this.callbacks.validate.call(this))}},onSave:function(){if("function"===typeof this.callbacks.save){this.callbacks.save.call(this)}this.onClose()},onClose:function(){if("function"===typeof this.callbacks.close){this.callbacks.close.call(this)}this.triggerMethod("destroy")}});module.exports=DialogView},{}],60:[function(require,module,exports){var SnapshotsCollection=require("../../entities/collections/snapshots"),SnapshotMenuItem=require("./show/snapshot-menu-item"),HistoryModule;Tailor.Items.History=SnapshotMenuItem;HistoryModule=Marionette.Module.extend({onBeforeStart:function(){var module=this;module.collection=new SnapshotsCollection;var api={getSnapshot:function(id){if(id){return module.collection.findWhere({id:id})}return module.collection}};app.channel.reply("sidebar:history",api.getSnapshot)},onStart:function(options){this.l10n=options.l10n;this.addEventListeners();app.channel.trigger("module:history:ready",this)},addEventListeners:function(){this.listenTo(app.channel,"element:add",this.onAddElement);this.listenTo(app.channel,"element:copy",this.onCopyElement);this.listenTo(app.channel,"element:move",this.onMoveElement);this.listenTo(app.channel,"modal:apply",this.onEditElement);this.listenTo(app.channel,"element:delete",this.onDeleteElement);this.listenTo(app.channel,"element:resize",this.onResizeElement);this.listenTo(app.channel,"navigation:reorder",this.onReorderElement);this.listenTo(app.channel,"template:add",this.onAddTemplate);this.listenTo(app.channel,"history:restore",this.restoreSnapshot);this.listenTo(app.channel,"history:undo",this.undoStep);this.listenTo(app.channel,"history:redo",this.redoStep)},onAddElement:function(model){if("library"==model.get("collection")){this.saveSnapshot(this.l10n.added+" "+model.get("label"))}},onEditElement:function(modal,model){this.saveSnapshot(this.l10n.edited+" "+model.get("label"))},onCopyElement:function(model){this.saveSnapshot(this.l10n.copied+" "+model.get("label"))},onMoveElement:function(model){this.saveSnapshot(this.l10n.moved+" "+model.get("label"))},onDeleteElement:function(model){this.saveSnapshot(this.l10n.deleted+" "+model.get("label"))},onResizeElement:function(model){this.saveSnapshot(this.l10n.resized+" "+model.get("label"))},onReorderElement:function(model){this.saveSnapshot(this.l10n.reordered+" "+model.get("label"))},onAddTemplate:function(model){this.saveSnapshot(this.l10n.added+" "+this.l10n.template+" - "+model.get("label"))},saveSnapshot:function(label){this.collection.save(label)},restoreSnapshot:function(timestamp){this.collection.restore(timestamp)},undoStep:function(){this.collection.undo()},redoStep:function(){this.collection.redo()}});module.exports=HistoryModule},{"../../entities/collections/snapshots":46,"./show/snapshot-menu-item":61}],61:[function(require,module,exports){var $=Backbone.$,HistoryItem;HistoryItem=Marionette.ItemView.extend({events:{click:"restore",keypress:"onKeyPress"},template:"#tmpl-tailor-panel-history-item",initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this.model.collection,"change:active",this.toggleClass)},onRender:function(){this.toggleClass()},attachElContent:function(html){var $el=$(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("tabindex",0);return this},onKeyPress:function(e){if(13===e.which){this.restore()}},restore:function(){var timestamp=this.model.get("timestamp");app.channel.trigger("before:history:restore",timestamp);app.channel.trigger("history:restore",timestamp)},toggleClass:function(model){model=model||this.model.collection.getActive();this.$el.toggleClass("is-active",model===this.model)}});module.exports=HistoryItem},{}],62:[function(require,module,exports){var LibraryCollection=require("../../entities/collections/library"),LibraryMenuItem=require("./show/library-menu-item"),LibraryModule;Tailor.Items.Library=LibraryMenuItem;LibraryModule=Marionette.Module.extend({onBeforeStart:function(options){var collection=new LibraryCollection(options.library);var api={getLibraryItem:function(tag){if(tag){return collection.findWhere({tag:tag})}return collection}};app.channel.reply("sidebar:library",api.getLibraryItem)},onStart:function(){app.channel.trigger("module:library:ready",this)}});module.exports=LibraryModule},{"../../entities/collections/library":41,"./show/library-menu-item":63}],63:[function(require,module,exports){var $=Backbone.$,ElementMenuItem;ElementMenuItem=Marionette.ItemView.extend({events:{click:"onClick",keypress:"onKeyPress"},modelEvents:{"change:match":"onSearch"},behaviors:{Draggable:{}},onClick:function(){var el=this.el;if(el.classList.contains("is-inactive")){return}var onAnimationEnd=function(e){el.removeEventListener(window.animationEndName,onAnimationEnd);el.classList.remove("shake")};if(Modernizr.cssanimations){el.addEventListener(window.animationEndName,onAnimationEnd);el.classList.add("shake")}Tailor.Notify(window._l10n.dragElement,"warning")},getTemplate:function(){return"#tmpl-tailor-panel-library-item"; - -},attachElContent:function(html){var $el=$(html);this.$el.replaceWith($el);this.setElement($el);return this},onSearch:function(model){this.el.style.display=!model.get("match")?"none":"block"}});module.exports=ElementMenuItem},{}],64:[function(require,module,exports){var ModalRegion=Backbone.Marionette.Region.extend({onShow:function(view,region,options){this.el.classList.add("is-visible");var rect=this.el.getBoundingClientRect();var width=this.el.style.width?this.el.style.width:rect.width;this.el.style.width=width+"px";if(!this.el.style.height){this.el.style.height=window.innerHeight-40+"px"}if(!this.el.style.top){this.el.style.top="20px"}if(!this.el.style.left){if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.el.style.left=20+"px"}else{this.el.style.left=window.innerWidth-(rect.width+20)+"px"}}this.updateClassName(width);this.listenTo(view,"modal:resize",this.onResize)},onResize:function(width,height){this.updateClassName(width)},updateClassName:function(width){this.$el.toggleClass("is-x-small",width<480).toggleClass("is-small",481=1200)},onEmpty:function(view,region,options){this.el.classList.remove("is-visible");this.stopListening(view,"modal:resize",this.onResize)}});module.exports=ModalRegion},{}],65:[function(require,module,exports){var ModalView=require("./show/modal"),ModalModule;ModalModule=Marionette.Module.extend({onStart:function(){var api={openModal:function(model){if(app.modal.hasView()){if(model===app.modal.currentView.model){return}app.modal.currentView.triggerMethod("close")}app.modal.show(new ModalView({model:model}))},closeModal:function(){app.modal.empty()}};this.listenTo(app.channel,"modal:open",api.openModal);this.listenTo(app.channel,"elements:reset",api.closeModal);app.channel.trigger("module:modal:ready",this)}});module.exports=ModalModule},{"./show/modal":68}],66:[function(require,module,exports){var EmptyModalView=Marionette.ItemView.extend({className:"empty",template:"#tmpl-tailor-modal-empty"});module.exports=EmptyModalView},{}],67:[function(require,module,exports){var EmptySectionView=Marionette.ItemView.extend({className:"empty",template:"#tmpl-tailor-section-default-empty"});module.exports=EmptySectionView},{}],68:[function(require,module,exports){var SectionCollectionView=require("./sections"),NavigationView=require("./tabs"),ModalView;ModalView=Marionette.LayoutView.extend({className:"modal",ui:{close:".js-close",apply:".js-apply"},behaviors:{Resizable:{ui:{handle:".modal__title"}}},triggers:{"click @ui.close":"close","click @ui.apply":"apply"},modelEvents:{destroy:"destroy"},template:"#tmpl-tailor-modal",regions:{tabs:"#tailor-modal-tabs",sections:"#tailor-modal-sections"},initialize:function(){this.isModified=false;this.settings=app.channel.request("sidebar:settings",this.model);this.addEventListeners();app.channel.trigger("modal:initialize",this,this.model)},addEventListeners:function(){this.listenTo(this.settings,"change",this.onChange)},onRender:function(){var model=this.model;var sections=app.channel.request("sidebar:sections",model);var controls=app.channel.request("sidebar:controls",model);this.showChildView("sections",new SectionCollectionView({element:model,collection:sections,controls:controls}));if(sections.length>1){this.showChildView("tabs",new NavigationView({collection:sections}));this.el.classList.add("has-sections")}model.collection.trigger("edit",model,true)},onShow:function(){this.ui.close.focus()},onChange:function(setting){this.isModified=true;this.ui.apply.attr("disabled",false);var model=this.model;if(!model.isTracking()){model.startTracking()}var update=setting.get("refresh");var jsRefresh=update.hasOwnProperty("method")&&"js"==update["method"];if(jsRefresh&&update.hasOwnProperty("dependencies")){for(var settingId in update["dependencies"]){if(update["dependencies"].hasOwnProperty(settingId)&&_.has(update["dependencies"][settingId],"condition")&&_.has(update["dependencies"][settingId],"value")){var targetSetting=setting.collection.get(settingId);if(targetSetting&&!Tailor.Helpers.checkCondition(update["dependencies"][settingId]["condition"],targetSetting.get("value"),update["dependencies"][settingId]["value"])){jsRefresh=false;break}}}}model.set("atts",this.atts(),{silent:jsRefresh});if(jsRefresh){model.trigger("change:setting",setting,model)}app.channel.trigger("canvas:reset")},onApply:function(){this.model.stopTracking();this.model.set("atts",this.atts());app.channel.trigger("modal:apply",this,this.model);this.triggerMethod("destroy")},onClose:function(){if(this.isModified){var applyChanges=confirm(window._l10n.confirmElement);if(true===applyChanges){this.triggerMethod("apply")}else{this.model.resetAttributes()}}app.channel.trigger("modal:close",this);this.triggerMethod("destroy")},onDestroy:function(){this.model.collection.trigger("edit",this.model,false);app.channel.trigger("modal:destroy",this,this.model)},atts:function(){var atts={};this.settings.each(function(setting){var value=setting.get("value");if(null!==value){atts[setting.get("id")]=value}},this);return atts}});module.exports=ModalView},{"./sections":70,"./tabs":72}],69:[function(require,module,exports){var ControlCollectionView=Marionette.CollectionView.extend({tagName:"ul",className:"controls controls--modal",emptyView:require("./empty-section"),getChildView:function(child){return Tailor.lookup(child.get("type"),false,"Controls")},childViewOptions:function(model,index){var options={model:model};if("list"===model.get("type")){options.element=this.element;options.collection=this.element.collection}return options},filter:function(child,index,collection){return child.get("section")===this.model.get("id")},initialize:function(options){this.model=options.model;this.element=options.element;this.addEventListeners()},addEventListeners:function(){this.listenTo(this.model.collection,"select",this.onSelect)},onSelect:function(model){this.$el.toggle(model===this.model)}});module.exports=ControlCollectionView},{"./empty-section":67}],70:[function(require,module,exports){var SectionCollectionView=Marionette.CollectionView.extend({childView:require("./section"),emptyView:require("./empty-modal"),childViewOptions:function(model,index){return{model:model,element:this.element,collection:this.controls}},initialize:function(options){this.element=options.element;this.controls=options.controls}});module.exports=SectionCollectionView},{"./empty-modal":66,"./section":69}],71:[function(require,module,exports){var NavigationItemView=Marionette.ItemView.extend({tagName:"li",className:"tab",attributes:{tabindex:0},events:{click:"select",keypress:"onKeyPress"},template:"#tmpl-tailor-modal-item",select:function(){this.triggerMethod("select")},onSelect:function(){this.model.trigger("select",this.model);this.el.focus()},onKeyPress:function(e){if(13===e.which){this.select()}}});module.exports=NavigationItemView},{}],72:[function(require,module,exports){var NavigationItemView=require("./tab"),NavigationView;NavigationView=Marionette.CollectionView.extend({tagName:"ul",className:"tabs",childView:NavigationItemView,childEvents:{select:"onSelect"},onRender:function(){if(this.collection.length>0){this.children.first().triggerMethod("select")}},onSelect:function(view){this.children.each(function(child){child.$el.toggleClass("is-active",view===child)})}});module.exports=NavigationView},{"./tab":71}],73:[function(require,module,exports){var Notify=window.Tailor.Notify,NotificationsModule;NotificationsModule=Marionette.Module.extend({onStart:function(){this.addEventListeners();app.channel.trigger("module:notifications:ready",this)},addEventListeners:function(){var l10n=window._l10n;this.listenTo(app.channel,"sidebar:save",function(){Notify(l10n.savedPage,"success")});this.listenTo(app.channel,"elements:restore",function(){Notify(l10n.restoreElements,"success")});this.listenTo(app.channel,"element:delete",function(){Notify(l10n.deletedElement,"success")});this.listenTo(app.channel,"template:save",function(){Notify(l10n.savedTemplate,"success")});this.listenTo(app.channel,"template:import",function(){Notify(l10n.importedTemplate,"success")});this.listenTo(app.channel,"template:add",function(){Notify(l10n.addedTemplate,"success")});this.listenTo(app.channel,"template:delete",function(){Notify(l10n.deletedTemplate,"success")})}});module.exports=NotificationsModule},{}],74:[function(require,module,exports){var PanelCollection=require("../../entities/collections/panels"),PanelLayoutView=require("./show/layout"),PanelMenuItem=require("./show/panel-menu-item"),PanelsModule;Tailor.Items.Panels=PanelMenuItem;PanelsModule=Marionette.Module.extend({onBeforeStart:function(options){var module=this;module.collection=new PanelCollection(options.panels);var api={getPanels:function(id){if(id){return module.collection.findWhere({id:id})}return module.collection}};app.channel.reply("sidebar:panels",api.getPanels)},onStart:function(){app.content.show(new PanelLayoutView({panels:app.channel.request("sidebar:panels"),sections:app.channel.request("sidebar:sections"),controls:app.channel.request("sidebar:controls"),settings:app.channel.request("sidebar:settings")}));app.channel.trigger("module:panels:ready",this)}});module.exports=PanelsModule},{"../../entities/collections/panels":42,"./show/layout":75,"./show/panel-menu-item":76}],75:[function(require,module,exports){var PanelsView=require("./panels"),PanelLayoutView;PanelLayoutView=Marionette.LayoutView.extend({ui:{pageTitle:".back-button"},className:"tailor-sidebar__layout",regions:{panels:"#tailor-sidebar-home",panel:"#tailor-sidebar-panel",section:"#tailor-sidebar-section"},childEvents:{"show:panel":"showPanel","show:section":"showSection","back:home":"displayHome","back:panel":"displayPanel"},template:function(){return document.getElementById("tmpl-tailor-sidebar-layout").innerHTML},initialize:function(options){this.panels=options.panels;this.sections=options.sections;this.controls=options.controls;this.settings=options.settings},onRender:function(){this.showChildView("panels",new PanelsView({collection:this.panels}))},showPanel:function(view){this.displayPanel();var collection=app.channel.request("sidebar:"+view.model.get("type"));var PanelView=Tailor.lookup(view.model.get("type"),false,"Panels");this.showChildView("panel",new PanelView({model:view.model,collection:collection}))},showSection:function(view){this.el.classList.add("section-visible");this.el.classList.remove("panel-visible");var SectionView=Tailor.lookup(view.model.get("type"),false,"Sections");this.showChildView("section",new SectionView({model:view.model,collection:this.controls,panel:this.panels.findWhere({id:view.model.get("panel")})}))},displayHome:function(view){this.el.classList.remove("panel-visible");this.el.classList.remove("section-visible");if(view){view.model.trigger("focus")}},displayPanel:function(view){this.el.classList.remove("section-visible");this.el.classList.add("panel-visible");if(view){view.model.trigger("focus")}}});module.exports=PanelLayoutView},{"./panels":78}],76:[function(require,module,exports){var $=Backbone.$,PanelItem;PanelItem=Marionette.ItemView.extend({events:{click:"onClick",keypress:"onKeyPress"},modelEvents:{focus:"onFocus"},template:"#tmpl-tailor-panel-default-item",attachElContent:function(html){var $el=$(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("tabindex",0);return this},onClick:function(){this.triggerMethod("show:panel")},onKeyPress:function(e){if(13===e.which){this.triggerMethod("show:panel")}},onFocus:function(){this.el.focus()}});module.exports=PanelItem},{}],77:[function(require,module,exports){var EmptyPanelView=Marionette.ItemView.extend({className:"empty",template:"#tmpl-tailor-home-empty"});module.exports=EmptyPanelView},{}],78:[function(require,module,exports){var PanelsView=Marionette.CompositeView.extend({getChildView:function(){return Tailor.lookup("panels",false,"Items")},childViewContainer:"#items",emptyView:require("./panels-empty"),behaviors:{Panel:{}},template:"#tmpl-tailor-home"});module.exports=PanelsView},{"./panels-empty":77}],79:[function(require,module,exports){var SectionCollection=require("../../entities/collections/sections"),DefaultMenuItem=require("./show/default-menu-item"),SectionsModule;Tailor.Items.Default=DefaultMenuItem;SectionsModule=Marionette.Module.extend({onBeforeStart:function(options){var module=this;module.collection={sidebar:new SectionCollection(options.sections)};var api={getSections:function(model){if(!model){return module.collection["sidebar"]}var cid=model.cid;if(!module.collection.hasOwnProperty(cid)){var itemDefinition=app.channel.request("sidebar:library",model.get("tag"));var sections=itemDefinition.get("sections")||[];module.collection[cid]=new SectionCollection(sections)}return module.collection[cid]}};app.channel.reply("sidebar:sections sidebar:default",api.getSections)},onStart:function(){app.channel.trigger("module:sections:ready",this)}});module.exports=SectionsModule},{"../../entities/collections/sections":44,"./show/default-menu-item":80}],80:[function(require,module,exports){var $=Backbone.$,DefaultItem;DefaultItem=Marionette.ItemView.extend({events:{click:"onClick",keypress:"onKeyPress"},modelEvents:{focus:"onFocus"},template:"#tmpl-tailor-panel-default-item",attachElContent:function(html){var $el=$(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("tabindex",0);return this},onClick:function(){this.triggerMethod("show:section")},onKeyPress:function(e){if(13===e.which){this.triggerMethod("show:section")}},onFocus:function(){this.el.focus()}});module.exports=DefaultItem},{}],81:[function(require,module,exports){var SettingCollection=require("../../entities/collections/settings"),ControlCollection=require("../../entities/collections/controls"),SettingsModule;SettingsModule=Marionette.Module.extend({onBeforeStart:function(options){var module=this;module.settings={sidebar:new SettingCollection(options.settings)};module.controls={sidebar:new ControlCollection(options.controls,{silent:false,settings:module.settings["sidebar"]})};var api={getControls:function(model){if(!model){return module.controls["sidebar"]}var cid=model.cid;if(!module.controls.hasOwnProperty(cid)){var itemDefinition=app.channel.request("sidebar:library",model.get("tag"));var controls=itemDefinition.get("controls")||[];var settings=api.getSettings(model);module.controls[cid]=new ControlCollection(controls,{silent:false,settings:settings})}return module.controls[cid]},getSettings:function(model){if(!model){return module.settings["sidebar"]}var cid=model.cid;if(!module.settings.hasOwnProperty(cid)){var itemDefinition=app.channel.request("sidebar:library",model.get("tag"));var settings=itemDefinition.get("settings")||[];module.settings[cid]=new SettingCollection(settings,{element:model})}module.settings[cid].load();return module.settings[cid]}};app.channel.reply("sidebar:controls",api.getControls);app.channel.reply("sidebar:settings",api.getSettings);this.listenTo(module.settings["sidebar"],"change",this.onChangeSetting)},onStart:function(){app.channel.trigger("module:settings:ready",this)},onChangeSetting:function(setting){app.channel.trigger("sidebar:setting:change",setting)}});module.exports=SettingsModule},{"../../entities/collections/controls":40,"../../entities/collections/settings":45}],82:[function(require,module,exports){var $=Backbone.$,l10n=window._l10n,TemplateMenuItem;TemplateMenuItem=Marionette.ItemView.extend({ui:{"delete":".js-delete-template",download:".js-download-template",preview:".js-preview-template"},events:{click:"onClick"},modelEvents:{"change:match":"onSearch"},behaviors:{Draggable:{}},onClick:function(e){switch(e.target){case this.ui.download.get(0):this.download();break;case this.ui.delete.get(0):this.delete();break;case this.ui.preview.get(0):this.preview();break;default:var el=this.el;var onAnimationEnd=function(e){el.removeEventListener(window.animationEndName,onAnimationEnd);el.classList.remove("shake")};if(Modernizr.cssanimations){el.addEventListener(window.animationEndName,onAnimationEnd);el.classList.add("shake")}Tailor.Notify(l10n.dragTemplate,"warning")}},getTemplate:function(){return"#tmpl-tailor-panel-templates-item"},attachElContent:function(html){var $el=$(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("tabindex",0);return this},download:function(){var item=this;var id=item.model.get("id");window.ajax.send("tailor_load_template",{data:{template_id:id,nonce:window._nonces.loadTemplate},success:function(response){var model=item.model;var models=response.models;var label=model.get("label");id=label.replace(" ","-").toLowerCase();var json={id:id,label:label,tag:model.get("tag"),type:model.get("type"),models:models};json="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(json));var a=document.getElementById("download-template");a.setAttribute("href",json);a.setAttribute("download","tailor-template-"+id+"-"+Date.now()+".json");a.click();app.channel.trigger("template:download")}})},"delete":function(){var that=this;window.ajax.send("tailor_delete_template",{data:{id:that.model.get("id"),nonce:window._nonces.deleteTemplate},success:function(){that.$el.slideUp(function(){that.model.trigger("destroy",that.model)});app.channel.trigger("template:delete")}})},preview:function(){window._urls.view+=(window._urls.view.split("?")[1]?"&":"?")+"template_preview=1&template_id="+this.model.get("id");window.open(window._urls.view,"_blank");app.channel.trigger("template:preview")},onSearch:function(model){this.el.style.display=!model.get("match")?"none":"block"}});module.exports=TemplateMenuItem},{}],83:[function(require,module,exports){var l10n=window._l10n,TemplatesPanel;TemplatesPanel=Marionette.CompositeView.extend({ui:{backButton:".back-button",save:".js-save-template","import":".js-import-template",searchForm:".search-form"},events:{"click @ui.save":"save","click @ui.import":"import"},triggers:{"click @ui.backButton":"back:home"},behaviors:{Panel:{}},emptyView:Tailor.Panels.Empty,emptyViewOptions:function(){return{type:this.model.get("type")}},template:"#tmpl-tailor-panel-templates",childViewContainer:"#items",getChildView:function(){return Tailor.lookup(this.model.get("type"),false,"Items")},serializeData:function(){var data=Marionette.ItemView.prototype.serializeData.apply(this,arguments);data.items=this.collection;return data},onShow:function(){this.ui.backButton.get(0).focus();if(0===this.collection.length){this.ui.searchForm.hide()}},onAddChild:function(){this.ui.searchForm.show()},onRemoveChild:function(){if(0===this.collection.length){this.ui.searchForm.hide()}},"import":function(e){var panel=this;var options={title:l10n.importTemplate,content:document.querySelector("#tmpl-tailor-dialog-import-template").innerHTML,button:l10n.import,onOpen:function(){this.el.querySelector("#import-template").focus()},onValidate:function(){var input=this.el.querySelector("#import-template");var re=/(?:\.([^.]+))?$/;return input.value&&"json"===re.exec(input.value)[1]},onSave:function(){var input=this.el.querySelector("#import-template");var file=input.files[0];if(!file||file.name.match(/.+\.json/)){var reader=new FileReader;reader.onload=function(e){var defaults={label:"",tag:"",models:[],nonce:window._nonces.saveTemplate};var data=_.extend(defaults,JSON.parse(reader.result));data.models=JSON.stringify(data.models);panel.createTemplate(data,"import")};try{reader.readAsText(file)}catch(e){}}},onClose:function(){panel.ui.import.focus()}};app.channel.trigger("dialog:open",options)},save:function(){var selected=app.channel.request("canvas:element:selected");var elements=app.channel.request("canvas:elements");var models=[];var tag;if(selected&&"function"==typeof selected.get){var getChildren=function(id){_.each(elements.where({parent:id}),function(model){models.push(model.toJSON());getChildren(model.get("id"))})};if("child"==selected.get("type")){selected=selected.collection.get(selected.get("parent"))}getChildren(selected.get("id"));selected=selected.toJSON();selected.parent="";models.push(selected);tag=selected.tag}else{models=elements.models;tag="tailor_section"}var panel=this;app.channel.trigger("dialog:open",{title:l10n.saveTemplate,content:document.querySelector("#tmpl-tailor-dialog-save-template").innerHTML,button:l10n.save,onOpen:function(){this.el.querySelector("#save-template").focus()},onValidate:function(){var input=this.el.querySelector("#save-template");return input.value.trim()},onSave:function(){var input=this.el.querySelector("#save-template");var data={label:input.value,tag:tag,models:JSON.stringify(models),nonce:window._nonces.saveTemplate};panel.createTemplate(data,"save")},onClose:function(){panel.ui.save.focus()}})},createTemplate:function(data,action){action=action||"save";var panel=this;var collection=panel.collection;panel.ui.save.prop("disabled",true);panel.ui.import.prop("disabled",true);window.ajax.send("tailor_save_template",{data:data,success:function(response){collection.add({id:response.id,label:response.label,tag:response.tag,type:response.type});app.channel.trigger("template:"+action)},complete:function(){panel.ui.save.prop("disabled",false);panel.ui.import.prop("disabled",false)}})}});module.exports=TemplatesPanel},{}],84:[function(require,module,exports){var TemplateCollection=require("../../entities/collections/templates"),TemplatesPanel=require("./show/templates-panel"),TemplateItem=require("./show/template-menu-item"),TemplatesModule;Tailor.Panels.Templates=TemplatesPanel;Tailor.Items.Templates=TemplateItem;TemplatesModule=Marionette.Module.extend({onBeforeStart:function(options){var module=this;this.collection=new TemplateCollection(options.templates);var api={getTemplates:function(){return module.collection}};app.channel.reply("sidebar:templates",api.getTemplates)},onStart:function(){app.channel.trigger("module:templates:ready",this)}});module.exports=TemplatesModule},{"../../entities/collections/templates":47,"./show/template-menu-item":82,"./show/templates-panel":83}],85:[function(require,module,exports){var $=jQuery;var title=document.querySelector(".tailor__home .title");Tailor.Api.Setting.onChange("sidebar:_post_title",function(to,from){if(title.hasChildNodes()){var children=title.childNodes;for(var i=1;i=1200)},onEmpty:function(view,region,options){this.el.classList.remove("is-visible");this.stopListening(view,"modal:resize",this.onResize)}});module.exports=ModalRegion},{}],65:[function(require,module,exports){var ModalView=require("./show/modal"),ModalModule;ModalModule=Marionette.Module.extend({onStart:function(){var api={openModal:function(model){if(app.modal.hasView()){if(model===app.modal.currentView.model){return}app.modal.currentView.triggerMethod("close")}app.modal.show(new ModalView({model:model}))},closeModal:function(){app.modal.empty()}};this.listenTo(app.channel,"modal:open",api.openModal);this.listenTo(app.channel,"elements:reset",api.closeModal);app.channel.trigger("module:modal:ready",this)}});module.exports=ModalModule},{"./show/modal":68}],66:[function(require,module,exports){var EmptyModalView=Marionette.ItemView.extend({className:"empty",template:"#tmpl-tailor-modal-empty"});module.exports=EmptyModalView},{}],67:[function(require,module,exports){var EmptySectionView=Marionette.ItemView.extend({className:"empty",template:"#tmpl-tailor-section-default-empty"});module.exports=EmptySectionView},{}],68:[function(require,module,exports){var SectionCollectionView=require("./sections"),NavigationView=require("./tabs"),ModalView;ModalView=Marionette.LayoutView.extend({className:"modal",ui:{close:".js-close",apply:".js-apply"},behaviors:{Resizable:{ui:{handle:".modal__title"}}},triggers:{"click @ui.close":"close","click @ui.apply":"apply"},modelEvents:{destroy:"destroy"},template:"#tmpl-tailor-modal",regions:{tabs:"#tailor-modal-tabs",sections:"#tailor-modal-sections"},initialize:function(){this.isModified=false;this.settings=app.channel.request("sidebar:settings",this.model);this.addEventListeners();app.channel.trigger("modal:initialize",this,this.model)},addEventListeners:function(){this.listenTo(this.settings,"change",this.onChange)},onRender:function(){var model=this.model;var sections=app.channel.request("sidebar:sections",model);var controls=app.channel.request("sidebar:controls",model);this.showChildView("sections",new SectionCollectionView({element:model,collection:sections,controls:controls}));if(sections.length>1){this.showChildView("tabs",new NavigationView({collection:sections}));this.el.classList.add("has-sections")}model.collection.trigger("edit",model,true)},onShow:function(){this.ui.close.focus()},onChange:function(setting){this.isModified=true;this.ui.apply.attr("disabled",false);var model=this.model;if(!model.isTracking()){model.startTracking()}var update=setting.get("refresh");var jsRefresh=update.hasOwnProperty("method")&&"js"==update["method"];if(jsRefresh&&update.hasOwnProperty("dependencies")){for(var settingId in update["dependencies"]){if(update["dependencies"].hasOwnProperty(settingId)&&_.has(update["dependencies"][settingId],"condition")&&_.has(update["dependencies"][settingId],"value")){var targetSetting=setting.collection.get(settingId);if(targetSetting&&!Tailor.Helpers.checkCondition(update["dependencies"][settingId]["condition"],targetSetting.get("value"),update["dependencies"][settingId]["value"])){jsRefresh=false;break}}}}model.set("atts",this.atts(),{silent:jsRefresh});if(jsRefresh){model.trigger("change:setting",setting,model)}app.channel.trigger("canvas:reset")},onApply:function(){this.model.stopTracking();this.model.set("atts",this.atts());app.channel.trigger("modal:apply",this,this.model);this.triggerMethod("destroy")},onClose:function(){if(this.isModified){var applyChanges=confirm(window._l10n.confirmElement);if(true===applyChanges){this.triggerMethod("apply")}else{this.model.resetAttributes()}}app.channel.trigger("modal:close",this);this.triggerMethod("destroy")},onDestroy:function(){this.model.collection.trigger("edit",this.model,false);app.channel.trigger("modal:destroy",this,this.model)},atts:function(){var atts={};this.settings.each(function(setting){var value=setting.get("value");if(null!==value){atts[setting.get("id")]=value}},this);return atts}});module.exports=ModalView},{"./sections":70,"./tabs":72}],69:[function(require,module,exports){var ControlCollectionView=Marionette.CollectionView.extend({tagName:"ul",className:"controls controls--modal",emptyView:require("./empty-section"),getChildView:function(child){return Tailor.lookup(child.get("type"),false,"Controls")},childViewOptions:function(model,index){var options={model:model};if("list"===model.get("type")){options.element=this.element;options.collection=this.element.collection}return options},filter:function(child,index,collection){return child.get("section")===this.model.get("id")},initialize:function(options){this.model=options.model;this.element=options.element;this.addEventListeners()},addEventListeners:function(){this.listenTo(this.model.collection,"select",this.onSelect)},onSelect:function(model){this.$el.toggle(model===this.model)}});module.exports=ControlCollectionView},{"./empty-section":67}],70:[function(require,module,exports){var SectionCollectionView=Marionette.CollectionView.extend({childView:require("./section"),emptyView:require("./empty-modal"),childViewOptions:function(model,index){return{model:model,element:this.element,collection:this.controls}},initialize:function(options){this.element=options.element;this.controls=options.controls}});module.exports=SectionCollectionView},{"./empty-modal":66,"./section":69}],71:[function(require,module,exports){var NavigationItemView=Marionette.ItemView.extend({tagName:"li",className:"tab",attributes:{tabindex:0},events:{click:"select",keypress:"onKeyPress"},template:"#tmpl-tailor-modal-item",select:function(){this.triggerMethod("select")},onSelect:function(){this.model.trigger("select",this.model);this.el.focus()},onKeyPress:function(e){if(13===e.which){this.select()}}});module.exports=NavigationItemView},{}],72:[function(require,module,exports){var NavigationItemView=require("./tab"),NavigationView;NavigationView=Marionette.CollectionView.extend({tagName:"ul",className:"tabs",childView:NavigationItemView,childEvents:{select:"onSelect"},onRender:function(){if(this.collection.length>0){this.children.first().triggerMethod("select")}},onSelect:function(view){this.children.each(function(child){child.$el.toggleClass("is-active",view===child)})}});module.exports=NavigationView},{"./tab":71}],73:[function(require,module,exports){var Notify=window.Tailor.Notify,NotificationsModule;NotificationsModule=Marionette.Module.extend({onStart:function(){this.addEventListeners();app.channel.trigger("module:notifications:ready",this)},addEventListeners:function(){var l10n=window._l10n;this.listenTo(app.channel,"sidebar:save",function(){Notify(l10n.savedPage,"success")});this.listenTo(app.channel,"elements:restore",function(){Notify(l10n.restoreElements,"success")});this.listenTo(app.channel,"element:delete",function(){Notify(l10n.deletedElement,"success")});this.listenTo(app.channel,"template:save",function(){Notify(l10n.savedTemplate,"success")});this.listenTo(app.channel,"template:import",function(){Notify(l10n.importedTemplate,"success")});this.listenTo(app.channel,"template:add",function(){Notify(l10n.addedTemplate,"success")});this.listenTo(app.channel,"template:delete",function(){Notify(l10n.deletedTemplate,"success")})}});module.exports=NotificationsModule},{}],74:[function(require,module,exports){var PanelCollection=require("../../entities/collections/panels"),PanelLayoutView=require("./show/layout"),PanelMenuItem=require("./show/panel-menu-item"),PanelsModule;Tailor.Items.Panels=PanelMenuItem;PanelsModule=Marionette.Module.extend({onBeforeStart:function(options){var module=this;module.collection=new PanelCollection(options.panels);var api={getPanels:function(id){if(id){return module.collection.findWhere({id:id})}return module.collection}};app.channel.reply("sidebar:panels",api.getPanels)},onStart:function(){app.content.show(new PanelLayoutView({panels:app.channel.request("sidebar:panels"),sections:app.channel.request("sidebar:sections"),controls:app.channel.request("sidebar:controls"),settings:app.channel.request("sidebar:settings")}));app.channel.trigger("module:panels:ready",this)}});module.exports=PanelsModule},{"../../entities/collections/panels":42,"./show/layout":75,"./show/panel-menu-item":76}],75:[function(require,module,exports){var PanelsView=require("./panels"),PanelLayoutView;PanelLayoutView=Marionette.LayoutView.extend({ui:{pageTitle:".back-button"},className:"tailor-sidebar__layout",regions:{panels:"#tailor-sidebar-home",panel:"#tailor-sidebar-panel",section:"#tailor-sidebar-section"},childEvents:{"show:panel":"showPanel","show:section":"showSection","back:home":"displayHome","back:panel":"displayPanel"},template:function(){return document.getElementById("tmpl-tailor-sidebar-layout").innerHTML},initialize:function(options){this.panels=options.panels;this.sections=options.sections;this.controls=options.controls;this.settings=options.settings},onRender:function(){this.showChildView("panels",new PanelsView({collection:this.panels}))},showPanel:function(view){this.displayPanel();var collection=app.channel.request("sidebar:"+view.model.get("type"));var PanelView=Tailor.lookup(view.model.get("type"),false,"Panels");this.showChildView("panel",new PanelView({model:view.model,collection:collection}))},showSection:function(view){this.el.classList.add("section-visible");this.el.classList.remove("panel-visible");var SectionView=Tailor.lookup(view.model.get("type"),false,"Sections");this.showChildView("section",new SectionView({model:view.model,collection:this.controls,panel:this.panels.findWhere({id:view.model.get("panel")})}))},displayHome:function(view){this.el.classList.remove("panel-visible");this.el.classList.remove("section-visible");if(view){view.model.trigger("focus")}},displayPanel:function(view){this.el.classList.remove("section-visible");this.el.classList.add("panel-visible");if(view){view.model.trigger("focus")}}});module.exports=PanelLayoutView},{"./panels":78}],76:[function(require,module,exports){var $=Backbone.$,PanelItem;PanelItem=Marionette.ItemView.extend({events:{click:"onClick",keypress:"onKeyPress"},modelEvents:{focus:"onFocus"},template:"#tmpl-tailor-panel-default-item",attachElContent:function(html){var $el=$(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("tabindex",0);return this},onClick:function(){this.triggerMethod("show:panel")},onKeyPress:function(e){if(13===e.which){this.triggerMethod("show:panel")}},onFocus:function(){this.el.focus()}});module.exports=PanelItem},{}],77:[function(require,module,exports){var EmptyPanelView=Marionette.ItemView.extend({className:"empty",template:"#tmpl-tailor-home-empty"});module.exports=EmptyPanelView},{}],78:[function(require,module,exports){var PanelsView=Marionette.CompositeView.extend({getChildView:function(){return Tailor.lookup("panels",false,"Items")},childViewContainer:"#items",emptyView:require("./panels-empty"),behaviors:{Panel:{}},template:"#tmpl-tailor-home"});module.exports=PanelsView},{"./panels-empty":77}],79:[function(require,module,exports){var SectionCollection=require("../../entities/collections/sections"),DefaultMenuItem=require("./show/default-menu-item"),SectionsModule;Tailor.Items.Default=DefaultMenuItem;SectionsModule=Marionette.Module.extend({onBeforeStart:function(options){var module=this;module.collection={sidebar:new SectionCollection(options.sections)};var api={getSections:function(model){if(!model){return module.collection["sidebar"]}var cid=model.cid;if(!module.collection.hasOwnProperty(cid)){var itemDefinition=app.channel.request("sidebar:library",model.get("tag"));var sections=itemDefinition.get("sections")||[];module.collection[cid]=new SectionCollection(sections)}return module.collection[cid]}};app.channel.reply("sidebar:sections sidebar:default",api.getSections)},onStart:function(){app.channel.trigger("module:sections:ready",this)}});module.exports=SectionsModule},{"../../entities/collections/sections":44,"./show/default-menu-item":80}],80:[function(require,module,exports){var $=Backbone.$,DefaultItem;DefaultItem=Marionette.ItemView.extend({events:{click:"onClick",keypress:"onKeyPress"},modelEvents:{focus:"onFocus"},template:"#tmpl-tailor-panel-default-item",attachElContent:function(html){var $el=$(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("tabindex",0);return this},onClick:function(){this.triggerMethod("show:section")},onKeyPress:function(e){if(13===e.which){this.triggerMethod("show:section")}},onFocus:function(){this.el.focus()}});module.exports=DefaultItem},{}],81:[function(require,module,exports){var SettingCollection=require("../../entities/collections/settings"),ControlCollection=require("../../entities/collections/controls"),SettingsModule;SettingsModule=Marionette.Module.extend({onBeforeStart:function(options){var module=this;module.settings={sidebar:new SettingCollection(options.settings)};module.controls={sidebar:new ControlCollection(options.controls,{silent:false,settings:module.settings["sidebar"]})};var api={getControls:function(model){if(!model){return module.controls["sidebar"]}var cid=model.cid;if(!module.controls.hasOwnProperty(cid)){var itemDefinition=app.channel.request("sidebar:library",model.get("tag"));var controls=itemDefinition.get("controls")||[];var settings=api.getSettings(model);module.controls[cid]=new ControlCollection(controls,{silent:false,settings:settings})}return module.controls[cid]},getSettings:function(model){if(!model){return module.settings["sidebar"]}var cid=model.cid;if(!module.settings.hasOwnProperty(cid)){var itemDefinition=app.channel.request("sidebar:library",model.get("tag"));var settings=itemDefinition.get("settings")||[];module.settings[cid]=new SettingCollection(settings,{element:model})}module.settings[cid].load();return module.settings[cid]}};app.channel.reply("sidebar:controls",api.getControls);app.channel.reply("sidebar:settings",api.getSettings);this.listenTo(module.settings["sidebar"],"change",this.onChangeSetting)},onStart:function(){app.channel.trigger("module:settings:ready",this)},onChangeSetting:function(setting){app.channel.trigger("sidebar:setting:change",setting)}});module.exports=SettingsModule},{"../../entities/collections/controls":40,"../../entities/collections/settings":45}],82:[function(require,module,exports){var $=Backbone.$,l10n=window._l10n,TemplateMenuItem;TemplateMenuItem=Marionette.ItemView.extend({ui:{delete:".js-delete-template",download:".js-download-template",preview:".js-preview-template"},events:{click:"onClick"},modelEvents:{"change:match":"onSearch"},behaviors:{Draggable:{}},onClick:function(e){switch(e.target){case this.ui.download.get(0):this.download();break;case this.ui.delete.get(0):this.delete();break;case this.ui.preview.get(0):this.preview();break;default:var el=this.el;var onAnimationEnd=function(e){el.removeEventListener(window.animationEndName,onAnimationEnd);el.classList.remove("shake")};if(Modernizr.cssanimations){el.addEventListener(window.animationEndName,onAnimationEnd);el.classList.add("shake")}Tailor.Notify(l10n.dragTemplate,"warning")}},getTemplate:function(){return"#tmpl-tailor-panel-templates-item"},attachElContent:function(html){var $el=$(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("tabindex",0);return this},download:function(){var item=this;var id=item.model.get("id");window.ajax.send("tailor_load_template",{data:{template_id:id,nonce:window._nonces.loadTemplate},success:function(response){var model=item.model;var models=response.models;var label=model.get("label");id=label.replace(" ","-").toLowerCase();var json={id:id,label:label,tag:model.get("tag"),type:model.get("type"),models:models};json="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(json));var a=document.getElementById("download-template");a.setAttribute("href",json);a.setAttribute("download","tailor-template-"+id+"-"+Date.now()+".json");a.click();app.channel.trigger("template:download")}})},delete:function(){var that=this;window.ajax.send("tailor_delete_template",{data:{id:that.model.get("id"),nonce:window._nonces.deleteTemplate},success:function(){that.$el.slideUp(function(){that.model.trigger("destroy",that.model)});app.channel.trigger("template:delete")}})},preview:function(){window._urls.view+=(window._urls.view.split("?")[1]?"&":"?")+"template_preview=1&template_id="+this.model.get("id");window.open(window._urls.view,"_blank");app.channel.trigger("template:preview")},onSearch:function(model){this.el.style.display=!model.get("match")?"none":"block"}});module.exports=TemplateMenuItem},{}],83:[function(require,module,exports){var l10n=window._l10n,TemplatesPanel;TemplatesPanel=Marionette.CompositeView.extend({ui:{backButton:".back-button",save:".js-save-template",import:".js-import-template",searchForm:".search-form"},events:{"click @ui.save":"save","click @ui.import":"import"},triggers:{"click @ui.backButton":"back:home"},behaviors:{Panel:{}},emptyView:Tailor.Panels.Empty,emptyViewOptions:function(){return{type:this.model.get("type")}},template:"#tmpl-tailor-panel-templates",childViewContainer:"#items",getChildView:function(){return Tailor.lookup(this.model.get("type"),false,"Items")},serializeData:function(){var data=Marionette.ItemView.prototype.serializeData.apply(this,arguments);data.items=this.collection;return data},onShow:function(){this.ui.backButton.get(0).focus();if(0===this.collection.length){this.ui.searchForm.hide()}},onAddChild:function(){this.ui.searchForm.show()},onRemoveChild:function(){if(0===this.collection.length){this.ui.searchForm.hide()}},import:function(e){var panel=this;var options={title:l10n.importTemplate,content:document.querySelector("#tmpl-tailor-dialog-import-template").innerHTML,button:l10n.import,onOpen:function(){this.el.querySelector("#import-template").focus()},onValidate:function(){var input=this.el.querySelector("#import-template");var re=/(?:\.([^.]+))?$/;return input.value&&"json"===re.exec(input.value)[1]},onSave:function(){var input=this.el.querySelector("#import-template");var file=input.files[0];if(!file||file.name.match(/.+\.json/)){var reader=new FileReader;reader.onload=function(e){var defaults={label:"",tag:"",models:[],nonce:window._nonces.saveTemplate};var data=_.extend(defaults,JSON.parse(reader.result));data.models=JSON.stringify(data.models);panel.createTemplate(data,"import")};try{reader.readAsText(file)}catch(e){}}},onClose:function(){panel.ui.import.focus()}};app.channel.trigger("dialog:open",options)},save:function(){var selected=app.channel.request("canvas:element:selected");var elements=app.channel.request("canvas:elements");var models=[];var tag;if(selected&&"function"==typeof selected.get){var getChildren=function(id){_.each(elements.where({parent:id}),function(model){models.push(model.toJSON());getChildren(model.get("id"))})};if("child"==selected.get("type")){selected=selected.collection.get(selected.get("parent"))}getChildren(selected.get("id"));selected=selected.toJSON();selected.parent="";models.push(selected);tag=selected.tag}else{models=elements.models;tag="tailor_section"}var panel=this;app.channel.trigger("dialog:open",{title:l10n.saveTemplate,content:document.querySelector("#tmpl-tailor-dialog-save-template").innerHTML,button:l10n.save,onOpen:function(){this.el.querySelector("#save-template").focus()},onValidate:function(){var input=this.el.querySelector("#save-template");return input.value.trim()},onSave:function(){var input=this.el.querySelector("#save-template");var data={label:input.value,tag:tag,models:JSON.stringify(models),nonce:window._nonces.saveTemplate};panel.createTemplate(data,"save")},onClose:function(){panel.ui.save.focus()}})},createTemplate:function(data,action){action=action||"save";var panel=this;var collection=panel.collection;panel.ui.save.prop("disabled",true);panel.ui.import.prop("disabled",true);window.ajax.send("tailor_save_template",{data:data,success:function(response){collection.add({id:response.id,label:response.label,tag:response.tag,type:response.type});app.channel.trigger("template:"+action)},complete:function(){panel.ui.save.prop("disabled",false);panel.ui.import.prop("disabled",false)}})}});module.exports=TemplatesPanel},{}],84:[function(require,module,exports){var TemplateCollection=require("../../entities/collections/templates"),TemplatesPanel=require("./show/templates-panel"),TemplateItem=require("./show/template-menu-item"),TemplatesModule;Tailor.Panels.Templates=TemplatesPanel;Tailor.Items.Templates=TemplateItem;TemplatesModule=Marionette.Module.extend({onBeforeStart:function(options){var module=this;this.collection=new TemplateCollection(options.templates);var api={getTemplates:function(){return module.collection}};app.channel.reply("sidebar:templates",api.getTemplates)},onStart:function(){app.channel.trigger("module:templates:ready",this)}});module.exports=TemplatesModule},{"../../entities/collections/templates":47,"./show/template-menu-item":82,"./show/templates-panel":83}],85:[function(require,module,exports){var $=jQuery;var title=document.querySelector(".tailor__home .title");Tailor.Api.Setting.onChange("sidebar:_post_title",function(to,from){if(title.hasChildNodes()){var children=title.childNodes;for(var i=1;i';ed.execCommand("mceInsertContent",0,""+icon+"  "+content+"
    ")},onClose:function(){this.$el.find(".search--icon").off("input")}})})}});tinymce.PluginManager.add("tailoricon",tinymce.plugins.tailoricon)})(tinymce,jQuery)},{}]},{},[1]); \ No newline at end of file +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o';ed.execCommand("mceInsertContent",0,""+icon+"  "+content+"
    ")},onClose:function(){this.$el.find(".search--icon").off("input")}})})}});tinymce.PluginManager.add("tailoricon",tinymce.plugins.tailoricon)})(tinymce,jQuery)},{}]},{},[1]); diff --git a/assets/js/dist/vendor/jquery-ui.min.js b/assets/js/dist/vendor/jquery-ui.min.js deleted file mode 100644 index 2a1d16f..0000000 --- a/assets/js/dist/vendor/jquery-ui.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/*! jQuery UI - v1.12.1 - 2017-03-09 -* http://jqueryui.com -* Includes: widget.js, position.js, data.js, disable-selection.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/tabs.js -* Copyright jQuery Foundation and other contributors; Licensed MIT */ - -(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function e(t){for(var e=t.css("visibility");"inherit"===e;)t=t.parent(),e=t.css("visibility");return"hidden"!==e}t.ui=t.ui||{},t.ui.version="1.12.1";var i=0,s=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},l=e.split(".")[0];e=e.split(".")[1];var h=l+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][h.toLowerCase()]=function(e){return!!t.data(e,h)},t[l]=t[l]||{},n=t[l][e],o=t[l][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:l,widgetName:e,widgetFullName:h}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var i,n,o=s.call(arguments,1),a=0,r=o.length;r>a;a++)for(i in o[a])n=o[a][i],o[a].hasOwnProperty(i)&&void 0!==n&&(e[i]=t.isPlainObject(n)?t.isPlainObject(e[i])?t.widget.extend({},e[i],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,i){var n=i.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=s.call(arguments,1),l=this;return a?this.length||"instance"!==o?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(l=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):l=void 0:(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new i(o,this))})),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
    ",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.on(h,c,r):i.on(h,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,l=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("
    "),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.widthi?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};h>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),l.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,l=n-r,h=r+e.collisionWidth-a-n;e.collisionWidth>a?l>0&&0>=h?(i=t.left+l+e.collisionWidth-a-n,t.left+=l-i):t.left=h>0&&0>=l?n:l>h?n+a-e.collisionWidth:n:l>0?t.left+=l:h>0?t.left-=h:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,l=n-r,h=r+e.collisionHeight-a-n;e.collisionHeight>a?l>0&&0>=h?(i=t.top+l+e.collisionHeight-a-n,t.top+=l-i):t.top=h>0&&0>=l?n:l>h?n+a-e.collisionHeight:n:l>0?t.top+=l:h>0?t.top-=h:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,l=n.isWindow?n.scrollLeft:n.offset.left,h=t.left-e.collisionPosition.marginLeft,c=h-l,u=h+e.collisionWidth-r-l,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-l,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,l=n.isWindow?n.scrollTop:n.offset.top,h=t.top-e.collisionPosition.marginTop,c=h-l,u=h+e.collisionHeight-r-l,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-l,(i>0||u>a(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}}),t.ui.focusable=function(i,s){var n,o,a,r,l,h=i.nodeName.toLowerCase();return"area"===h?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(h)?(r=!i.disabled,r&&(l=t(i).closest("fieldset")[0],l&&(r=!l.disabled))):r="a"===h?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.widget("ui.accordion",{version:"1.12.1",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:"> li > :first-child, > :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var e=this.options;this.prevShow=this.prevHide=t(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),e.collapsible||e.active!==!1&&null!=e.active||(e.active=0),this._processPanels(),0>e.active&&(e.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():t()}},_createIcons:function(){var e,i,s=this.options.icons;s&&(e=t(""),this._addClass(e,"ui-accordion-header-icon","ui-icon "+s.header),e.prependTo(this.headers),i=this.active.children(".ui-accordion-header-icon"),this._removeClass(i,s.header)._addClass(i,null,s.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||this.options.active!==!1||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons()),void 0)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(e){if(!e.altKey&&!e.ctrlKey){var i=t.ui.keyCode,s=this.headers.length,n=this.headers.index(e.target),o=!1;switch(e.keyCode){case i.RIGHT:case i.DOWN:o=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:o=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(e);break;case i.HOME:o=this.headers[0];break;case i.END:o=this.headers[s-1]}o&&(t(e.target).attr("tabIndex",-1),t(o).attr("tabIndex",0),t(o).trigger("focus"),e.preventDefault())}},_panelKeyDown:function(e){e.keyCode===t.ui.keyCode.UP&&e.ctrlKey&&t(e.currentTarget).prev().trigger("focus")},refresh:function(){var e=this.options;this._processPanels(),e.active===!1&&e.collapsible===!0||!this.headers.length?(e.active=!1,this.active=t()):e.active===!1?this._activate(0):this.active.length&&!t.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(e.active=!1,this.active=t()):this._activate(Math.max(0,e.active-1)):e.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var e,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var e=t(this),i=e.uniqueId().attr("id"),s=e.next(),n=s.uniqueId().attr("id");e.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(e=n.height(),this.element.siblings(":visible").each(function(){var i=t(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(e-=i.outerHeight(!0))}),this.headers.each(function(){e-=t(this).outerHeight(!0)}),this.headers.next().each(function(){t(this).height(Math.max(0,e-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===s&&(e=0,this.headers.next().each(function(){var i=t(this).is(":visible");i||t(this).show(),e=Math.max(e,t(this).css("height","").height()),i||t(this).hide()}).height(e))},_activate:function(e){var i=this._findActive(e)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return"number"==typeof e?this.headers.eq(e):t()},_setupEvents:function(e){var i={keydown:"_keydown"};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(e){var i,s,n=this.options,o=this.active,a=t(e.currentTarget),r=a[0]===o[0],l=r&&n.collapsible,h=l?t():a.next(),c=o.next(),u={oldHeader:o,oldPanel:c,newHeader:l?t():a,newPanel:h};e.preventDefault(),r&&!n.collapsible||this._trigger("beforeActivate",e,u)===!1||(n.active=l?!1:this.headers.index(a),this.active=r?t():a,this._toggle(u),this._removeClass(o,"ui-accordion-header-active","ui-state-active"),n.icons&&(i=o.children(".ui-accordion-header-icon"),this._removeClass(i,null,n.icons.activeHeader)._addClass(i,null,n.icons.header)),r||(this._removeClass(a,"ui-accordion-header-collapsed")._addClass(a,"ui-accordion-header-active","ui-state-active"),n.icons&&(s=a.children(".ui-accordion-header-icon"),this._removeClass(s,null,n.icons.header)._addClass(s,null,n.icons.activeHeader)),this._addClass(a.next(),"ui-accordion-content-active")))},_toggle:function(e){var i=e.newPanel,s=this.prevShow.length?this.prevShow:e.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,e):(s.hide(),i.show(),this._toggleComplete(e)),s.attr({"aria-hidden":"true"}),s.prev().attr({"aria-selected":"false","aria-expanded":"false"}),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===parseInt(t(this).attr("tabIndex"),10)}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,e,i){var s,n,o,a=this,r=0,l=t.css("box-sizing"),h=t.length&&(!e.length||t.index()1&&i===s}}(),_create:function(){var e=this,i=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,i.collapsible),this._processTabs(),i.active=this._initialActive(),t.isArray(i.disabled)&&(i.disabled=t.unique(i.disabled.concat(t.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):t(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var e=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===e&&(s&&this.tabs.each(function(i,n){return t(n).attr("aria-controls")===s?(e=i,!1):void 0}),null===e&&(e=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===e||-1===e)&&(e=this.tabs.length?0:!1)),e!==!1&&(e=this.tabs.index(this.tabs.eq(e)),-1===e&&(e=i?!1:0)),!i&&e===!1&&this.anchors.length&&(e=0),e},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):t()}},_tabKeydown:function(e){var i=t(t.ui.safeActiveElement(this.document[0])).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(e)){switch(e.keyCode){case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:s++;break;case t.ui.keyCode.UP:case t.ui.keyCode.LEFT:n=!1,s--;break;case t.ui.keyCode.END:s=this.anchors.length-1;break;case t.ui.keyCode.HOME:s=0;break;case t.ui.keyCode.SPACE:return e.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case t.ui.keyCode.ENTER:return e.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}e.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),e.ctrlKey||e.metaKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(e){this._handlePageNav(e)||e.ctrlKey&&e.keyCode===t.ui.keyCode.UP&&(e.preventDefault(),this.active.trigger("focus"))},_handlePageNav:function(e){return e.altKey&&e.keyCode===t.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):e.altKey&&e.keyCode===t.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(e,i){function s(){return e>n&&(e=0),0>e&&(e=n),e}for(var n=this.tabs.length-1;-1!==t.inArray(s(),this.options.disabled);)e=i?e+1:e-1;return e},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).trigger("focus"),t},_setOption:function(t,e){return"active"===t?(this._activate(e),void 0):(this._super(t,e),"collapsible"===t&&(this._toggleClass("ui-tabs-collapsible",null,e),e||this.options.active!==!1||this._activate(0)),"event"===t&&this._setupEvents(e),"heightStyle"===t&&this._setupHeightStyle(e),void 0)},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var e=this.options,i=this.tablist.children(":has(a[href])");e.disabled=t.map(i.filter(".ui-state-disabled"),function(t){return i.index(t)}),this._processTabs(),e.active!==!1&&this.anchors.length?this.active.length&&!t.contains(this.tablist[0],this.active[0])?this.tabs.length===e.disabled.length?(e.active=!1,this.active=t()):this._activate(this._findNextTab(Math.max(0,e.active-1),!1)):e.active=this.tabs.index(this.active):(e.active=!1,this.active=t()),this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var e=this,i=this.tabs,s=this.anchors,n=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,"> li",function(e){t(this).is(".ui-state-disabled")&&e.preventDefault()}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){t(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return t("a",this)[0]}).attr({role:"presentation",tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=t(),this.anchors.each(function(i,s){var n,o,a,r=t(s).uniqueId().attr("id"),l=t(s).closest("li"),h=l.attr("aria-controls");e._isLocal(s)?(n=s.hash,a=n.substring(1),o=e.element.find(e._sanitizeSelector(n))):(a=l.attr("aria-controls")||t({}).uniqueId()[0].id,n="#"+a,o=e.element.find(n),o.length||(o=e._createPanel(a),o.insertAfter(e.panels[i-1]||e.tablist)),o.attr("aria-live","polite")),o.length&&(e.panels=e.panels.add(o)),h&&l.data("ui-tabs-aria-controls",h),l.attr({"aria-controls":a,"aria-labelledby":r}),o.attr("aria-labelledby",r) -}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(e){return t("
    ").attr("id",e).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(e){var i,s,n;for(t.isArray(e)&&(e.length?e.length===this.anchors.length&&(e=!0):e=!1),n=0;s=this.tabs[n];n++)i=t(s),e===!0||-1!==t.inArray(n,e)?(i.attr("aria-disabled","true"),this._addClass(i,null,"ui-state-disabled")):(i.removeAttr("aria-disabled"),this._removeClass(i,null,"ui-state-disabled"));this.options.disabled=e,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,e===!0)},_setupEvents:function(e){var i={};e&&t.each(e.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(e){var i,s=this.element.parent();"fill"===e?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var e=t(this),s=e.css("position");"absolute"!==s&&"fixed"!==s&&(i-=e.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=t(this).outerHeight(!0)}),this.panels.each(function(){t(this).height(Math.max(0,i-t(this).innerHeight()+t(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.panels.each(function(){i=Math.max(i,t(this).height("").height())}).height(i))},_eventHandler:function(e){var i=this.options,s=this.active,n=t(e.currentTarget),o=n.closest("li"),a=o[0]===s[0],r=a&&i.collapsible,l=r?t():this._getPanelForTab(o),h=s.length?this._getPanelForTab(s):t(),c={oldTab:s,oldPanel:h,newTab:r?t():o,newPanel:l};e.preventDefault(),o.hasClass("ui-state-disabled")||o.hasClass("ui-tabs-loading")||this.running||a&&!i.collapsible||this._trigger("beforeActivate",e,c)===!1||(i.active=r?!1:this.tabs.index(o),this.active=a?t():o,this.xhr&&this.xhr.abort(),h.length||l.length||t.error("jQuery UI Tabs: Mismatching fragment identifier."),l.length&&this.load(this.tabs.index(o),e),this._toggle(e,c))},_toggle:function(e,i){function s(){o.running=!1,o._trigger("activate",e,i)}function n(){o._addClass(i.newTab.closest("li"),"ui-tabs-active","ui-state-active"),a.length&&o.options.show?o._show(a,o.options.show,s):(a.show(),s())}var o=this,a=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){o._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),n()}):(this._removeClass(i.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),a.length&&r.length?i.oldTab.attr("tabIndex",-1):a.length&&this.tabs.filter(function(){return 0===t(this).attr("tabIndex")}).attr("tabIndex",-1),a.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(e){var i,s=this._findActive(e);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:t.noop}))},_findActive:function(e){return e===!1?t():this.tabs.eq(e)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+t.ui.escapeSelector(e)+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){t.data(this,"ui-tabs-destroy")?t(this).remove():t(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}),this.tabs.each(function(){var e=t(this),i=e.data("ui-tabs-aria-controls");i?e.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):e.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(e){var i=this.options.disabled;i!==!1&&(void 0===e?i=!1:(e=this._getIndex(e),i=t.isArray(i)?t.map(i,function(t){return t!==e?t:null}):t.map(this.tabs,function(t,i){return i!==e?i:null})),this._setOptionDisabled(i))},disable:function(e){var i=this.options.disabled;if(i!==!0){if(void 0===e)i=!0;else{if(e=this._getIndex(e),-1!==t.inArray(e,i))return;i=t.isArray(i)?t.merge([e],i).sort():[e]}this._setOptionDisabled(i)}},load:function(e,i){e=this._getIndex(e);var s=this,n=this.tabs.eq(e),o=n.find(".ui-tabs-anchor"),a=this._getPanelForTab(n),r={tab:n,panel:a},l=function(t,e){"abort"===e&&s.panels.stop(!1,!0),s._removeClass(n,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===s.xhr&&delete s.xhr};this._isLocal(o[0])||(this.xhr=t.ajax(this._ajaxSettings(o,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(this._addClass(n,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done(function(t,e,n){setTimeout(function(){a.html(t),s._trigger("load",i,r),l(n,e)},1)}).fail(function(t,e){setTimeout(function(){l(t,e)},1)})))},_ajaxSettings:function(e,i,s){var n=this;return{url:e.attr("href").replace(/#.*$/,""),beforeSend:function(e,o){return n._trigger("beforeLoad",i,t.extend({jqXHR:e,ajaxSettings:o},s))}}},_getPanelForTab:function(e){var i=t(e).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),t.uiBackCompat!==!1&&t.widget("ui.tabs",t.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}}),t.ui.tabs}); \ No newline at end of file diff --git a/assets/js/src/shared/components/ui/toggles.js b/assets/js/src/shared/components/ui/toggles.js index 127e136..e1c57f9 100644 --- a/assets/js/src/shared/components/ui/toggles.js +++ b/assets/js/src/shared/components/ui/toggles.js @@ -22,96 +22,100 @@ Toggles = Components.create( { }; }, - /** - * Initializes the component. - * - * @since 1.7.5 - */ - onInitialize : function() { - this.querySelectors(); - - var initial = this.options.initial - 1; - if ( initial >= 0 && this.$toggles.length > initial ) { - this.activate( this.$toggles[ initial ] ); - } - }, - - /** - * Caches the toggles and toggle content. - * - * @since 1.0.0 - */ - querySelectors : function() { - this.$content = this.$el.find( this.options.content ).hide(); - this.$toggles = this.$el - .find( this.options.toggles ) - .off() - .on( 'click', $.proxy( this.onClick, this ) ); - }, - - /** - * Activates a given toggle. - * - * @since 1.0.0 - * - * @param el - */ - activate: function( el ) { - var speed = this.options.speed; - var $el = $( el ); - - if ( this.options.accordion ) { - this.$toggles.filter( function() { - return this !== el; - } ).removeClass( 'is-active' ); - - this.$content.each( function() { - var $toggle = $( this ); - if ( el.nextElementSibling == this ) { - $toggle.slideToggle( speed ); - } - else { - $toggle.slideUp( speed ); - } - } ); - } - else { - this.$content - .filter( function() { return el.nextElementSibling == this; } ) - .slideToggle( speed ); - } - - $el.toggleClass( 'is-active' ); - - $win.trigger( 'resize' ); - }, - - /** - * Activates a toggle when it is clicked. - * - * @since 1.7.5 - * - * @param e - */ - onClick: function( e ) { - this.activate( e.target ); - e.preventDefault(); - }, + initialize : function() { + this.$el.tabs(); + } - /** - * Element listeners - */ - onDestroy: function( e ) { - this.$toggles.off(); - }, + // /** + // * Initializes the component. + // * + // * @since 1.7.5 + // */ + // onInitialize : function() { + // this.querySelectors(); + // + // var initial = this.options.initial - 1; + // if ( initial >= 0 && this.$toggles.length > initial ) { + // this.activate( this.$toggles[ initial ] ); + // } + // }, + // + // /** + // * Caches the toggles and toggle content. + // * + // * @since 1.0.0 + // */ + // querySelectors : function() { + // this.$content = this.$el.find( this.options.content ).hide(); + // this.$toggles = this.$el + // .find( this.options.toggles ) + // .off() + // .on( 'click', $.proxy( this.onClick, this ) ); + // }, + // + // /** + // * Activates a given toggle. + // * + // * @since 1.0.0 + // * + // * @param el + // */ + // activate: function( el ) { + // var speed = this.options.speed; + // var $el = $( el ); + // + // if ( this.options.accordion ) { + // this.$toggles.filter( function() { + // return this !== el; + // } ).removeClass( 'is-active' ); + // + // this.$content.each( function() { + // var $toggle = $( this ); + // if ( el.nextElementSibling == this ) { + // $toggle.slideToggle( speed ); + // } + // else { + // $toggle.slideUp( speed ); + // } + // } ); + // } + // else { + // this.$content + // .filter( function() { return el.nextElementSibling == this; } ) + // .slideToggle( speed ); + // } + // + // $el.toggleClass( 'is-active' ); + // + // $win.trigger( 'resize' ); + // }, + // + // /** + // * Activates a toggle when it is clicked. + // * + // * @since 1.7.5 + // * + // * @param e + // */ + // onClick: function( e ) { + // this.activate( e.target ); + // e.preventDefault(); + // }, + // + // /** + // * Element listeners + // */ + // onDestroy: function( e ) { + // this.$toggles.off(); + // }, + // + // /** + // * Child listeners + // */ + // onChangeChild: function() { + // this.querySelectors(); + // } - /** - * Child listeners - */ - onChangeChild: function() { - this.querySelectors(); - } - } ); /** diff --git a/tailor.php b/tailor.php index 8c06471..c4604f3 100644 --- a/tailor.php +++ b/tailor.php @@ -178,7 +178,7 @@ public function body_class( $classes ) { * @since 1.0.0 */ public function init() { - + load_plugin_textdomain( 'tailor', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); add_filter( 'body_class', array( $this, 'body_class' ) ); @@ -216,7 +216,7 @@ public function init() { 'class-customizer', 'class-widgets', ) ); - + /** * Fires after all files have been loaded. * @@ -403,6 +403,8 @@ public function enqueue_frontend_scripts() { if ( apply_filters( 'tailor_enable_frontend_scripts', true ) ) { // Enqueue script dependencies + wp_enqueue_script( 'jquery-ui-tabs' ); + wp_enqueue_script( 'jquery-ui-accordion'); wp_enqueue_script( 'slick-slider' ); wp_enqueue_script( 'shuffle' ); wp_enqueue_script( 'magnific-popup' ); @@ -672,7 +674,7 @@ public function check_user_role() { if ( ! is_user_logged_in() ) { auth_redirect(); } - + // Check that the user can manage option and/or edit the post type $user = wp_get_current_user(); $post_id = get_the_ID(); @@ -694,9 +696,9 @@ public function check_user_role() { /** * Filter the result of the user role check. - * + * * @since 1.3.1 - * + * * @param bool $allowable */ return apply_filters( 'tailor_check_user', $allowable ); @@ -969,4 +971,4 @@ function tailor() { * * @since 1.0.0 */ -tailor(); \ No newline at end of file +tailor(); From e576df1b019fa52d6c942adddc063cc4c76dfef8 Mon Sep 17 00:00:00 2001 From: Kristofer Raske Date: Thu, 9 Mar 2017 16:13:42 -0600 Subject: [PATCH 3/8] Oh actually toggles = accordions. Alright this isn't quite working as we expect. We need a HTML structure of... ``` accordion-wrapper h3 div h3 div h3 div ``` Here is what we have ``` accordion-wrapper toggle-wrapper h3 div toggle-wrapper h3 div ``` --- assets/js/dist/canvas.js | 2 +- assets/js/dist/canvas.min.js | 4 ++-- assets/js/dist/frontend.js | 2 +- assets/js/dist/frontend.min.js | 2 +- assets/js/src/shared/components/ui/toggles.js | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/js/dist/canvas.js b/assets/js/dist/canvas.js index 1862c16..29df0ae 100644 --- a/assets/js/dist/canvas.js +++ b/assets/js/dist/canvas.js @@ -9418,7 +9418,7 @@ Toggles = Components.create( { }, initialize : function() { - this.$el.tabs(); + this.$el.accordion(); } // /** diff --git a/assets/js/dist/canvas.min.js b/assets/js/dist/canvas.min.js index aa158af..f48d5c6 100644 --- a/assets/js/dist/canvas.min.js +++ b/assets/js/dist/canvas.min.js @@ -1,5 +1,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o'+'
    '+"
    ")},onResize:function(e){var columnView=this;var device=app.channel.request("sidebar:device");var setting="desktop"==device?"width":"width_"+device;var model=columnView.model;var nextModel=model.collection.findWhere({parent:model.get("parent"),order:model.get("order")+1});var atts=model.get("atts");var nextAtts=nextModel.get("atts");var width=parseFloat(atts[setting]||atts.width);var nextWidth=parseFloat(nextAtts[setting]||nextAtts.width);var columnsWidth=width+nextWidth;var column=columnView.el.getBoundingClientRect();var $first=$(''+width+"%");var $second=$(''+nextWidth+"%");$first.prependTo(columnView.$el);$second.prependTo(columnView.$el.next());function onResize(e){document.body.classList.add("is-resizing");document.body.style.cursor="col-resize";var columnWidth=Math.min(columnsWidth-10,Math.max(10,Math.round(parseFloat((e.clientX-column.left)/column.width*width)*10)/10));var nextColumnWidth=Math.round(parseFloat(columnsWidth-columnWidth)*10)/10;columnWidth+="%";nextColumnWidth+="%";$first.html(columnWidth);$second.html(nextColumnWidth);var atts=_.clone(model.get("atts"));var nextAtts=_.clone(nextModel.get("atts"));atts[setting]=columnWidth;nextAtts[setting]=nextColumnWidth;model.set("atts",atts,{silent:true});nextModel.set("atts",nextAtts,{silent:true});model.trigger("change:width",model,atts);nextModel.trigger("change:width",nextModel,nextAtts)}function onResizeEnd(){document.removeEventListener("mousemove",onResize,false);document.removeEventListener("mouseup",onResizeEnd,false);document.body.classList.remove("is-resizing");document.body.style.cursor="default";$first.remove();$second.remove();var atts=model.get("atts");if(width!=atts[setting]){app.channel.trigger("element:resize",model)}}document.addEventListener("mousemove",onResize,false);document.addEventListener("mouseup",onResizeEnd,false);app.channel.trigger("canvas:reset");return false},onChangeWidth:function(model,atts){this.updateCSS(model.get("id"),atts);this.triggerAll("element:refresh",this)},updateCSS:function(elementId,atts){var ruleSet={};var width=atts["width"];var tabletWidth=atts["width_tablet"]||atts["width"];var mobileWidth=atts["width_mobile"]||atts["width"];ruleSet["desktop"]={};ruleSet["desktop"][elementId]=[{selectors:[],declarations:{width:width},setting:"width"}];ruleSet["tablet"]={};ruleSet["tablet"][elementId]=[{selectors:[".mobile-columns &",".tablet-columns &"],declarations:{width:tabletWidth},setting:"width_tablet"}];ruleSet["mobile"]={};ruleSet["mobile"][elementId]=[{selectors:[".mobile-columns &"],declarations:{width:mobileWidth},setting:"width_mobile"}];cssModule.deleteRules(elementId,"width");cssModule.deleteRules(elementId,"width_tablet");cssModule.deleteRules(elementId,"width_mobile");cssModule.addRules(ruleSet)}});module.exports=ColumnView},{"./../element-container":17}],10:[function(require,module,exports){var ContainerView=require("./../element-container"),TabView;TabView=ContainerView.extend({onRenderTemplate:function(){this.el.draggable=false;this.el.id=this.model.cid}});module.exports=TabView},{"./../element-container":17}],11:[function(require,module,exports){var ContainerView=require("./../element-container"),CarouselNavigationView=require("./navigation/carousel-navigation"),CarouselView;CarouselView=ContainerView.extend({onBeforeRenderTemplate:function(){if(this.navigation){this.navigation.triggerMethod("destroy")}},onRenderTemplate:function(){this.navigation=new CarouselNavigationView({model:this.model,collection:this.collection,sort:false});this.$el.append(this.navigation.render().el)},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this);this.navigation.triggerMethod("destroy")}});module.exports=CarouselView},{"./../element-container":17,"./navigation/carousel-navigation":13}],12:[function(require,module,exports){module.exports=Marionette.ItemView.extend({tagName:"li",attributes:function(){return{"data-id":this.model.cid}},getTemplate:function(){return _.template('')}})},{}],13:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({tagName:"ul",className:"slick-dots",childView:require("./carousel-navigation-item"),events:{dragstart:"onDragStart"},onDragStart:function(e){app.channel.trigger("canvas:reset");e.stopPropagation()},onRender:function(){var view=this;this.sortable=new Sortable(view.el,{draggable:"li",animation:150,onUpdate:function(e){var cid=e.item.getAttribute("data-id");view.$el.trigger("before:navigation:reorder",[cid,e.newIndex,e.oldIndex]);view.$el.trigger("navigation:reorder",[cid,e.newIndex,e.oldIndex]);app.channel.trigger("navigation:reorder",view.model)}})},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return child.get("parent")===this.model.get("id")},onBeforeDestroy:function(){this.sortable.destroy()}})},{"./carousel-navigation-item":12}],14:[function(require,module,exports){module.exports=Marionette.ItemView.extend({tagName:"li",className:function(){return"tailor-tabs__navigation-item tailor-"+this.model.get("id")},modelEvents:{"change:atts":"onChangeAttributes"},attributes:function(){return{"data-id":this.model.cid}},getTemplate:function(){return _.template('<%= title || "Tab" %>')},serializeData:function(){var data=Marionette.ItemView.prototype.serializeData.apply(this,arguments);var atts=this.model.get("atts");data.title=atts.title;return data},onChangeAttributes:function(model,atts){this.el.innerHTML=atts.title||"Tab"}})},{}],15:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({childView:require("./tabs-navigation-item"),events:{dragstart:"onDragStart"},onDragStart:function(e){app.channel.trigger("canvas:reset");e.stopPropagation()},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return child.get("parent")===this.model.get("id")},onRender:function(){var view=this;this.sortable=new Sortable(view.el,{draggable:"li",animation:150,onUpdate:function(e){var cid=e.item.getAttribute("data-id");view.$el.trigger("before:navigation:reorder",[cid,e.newIndex,e.oldIndex]);view.$el.trigger("navigation:reorder",[cid,e.newIndex,e.oldIndex]);app.channel.trigger("navigation:reorder",view.model)}})},onBeforeDestroy:function(){this.sortable.destroy()}})},{"./tabs-navigation-item":14}],16:[function(require,module,exports){var ContainerView=require("./../element-container"),TabsNavigationView=require("./navigation/tabs-navigation"),TabsView;TabsView=ContainerView.extend({ui:{navigation:".tailor-tabs__navigation"},onBeforeRenderTemplate:function(){if(this.navigation){this.navigation.triggerMethod("destroy")}},onRenderTemplate:function(){this.navigation=new TabsNavigationView({el:this.ui.navigation,model:this.model,collection:this.collection,sort:false});this.navigation.render()},childRefreshed:function(childView){childView.el.id=childView.model.cid;childView.el.classList.add("is-active");this.triggerAll("element:child:refresh",childView)},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this);this.navigation.triggerMethod("destroy")}});module.exports=TabsView},{"./../element-container":17,"./navigation/tabs-navigation":15}],17:[function(require,module,exports){var CompositeView=Marionette.CompositeView.extend({behaviors:{Container:{},Draggable:{},Droppable:{},Editable:{},Movable:{}},modelEvents:{"change:atts":"onChangeAttributes","change:order":"onChangeOrder","change:parent":"onChangeParent","change:setting":"onChangeSetting"},childEvents:{"before:element:ready":"beforeChildElementReady","element:ready":"childElementReady","before:element:refresh":"beforeChildElementRefreshed","element:refresh":"childElementRefreshed","before:element:jsRefresh":"beforeChildElementJSRefreshed","element:jsRefresh":"childElementJSRefreshed","element:change:parent":"childElementChangeParent","element:change:order":"childElementChangeOrder","before:element:destroy":"beforeChildElementDestroyed","element:destroy":"childElementDestroyed"},events:{"before:element:ready":"stopEventPropagation","element:ready":"stopEventPropagation","before:element:refresh":"stopEventPropagation","element:refresh":"stopEventPropagation","before:element:copy":"stopEventPropagation","element:copy":"stopEventPropagation","element:child:change:parent":"onDescendantChangeParent","element:child:change:order":"onDescendantChangeOrder","before:element:destroy":"stopEventPropagation","element:destroy":"stopEventPropagation","element:child:add":"onDescendantAdded","element:child:remove":"onDescendantRemoved","before:element:child:ready":"onBeforeDescendantReady","element:child:ready":"onDescendantReady","before:element:child:refresh":"onBeforeDescendantRefreshed","element:child:refresh":"onDescendantRefreshed","before:element:child:jsRefresh":"onBeforeDescendantJSRefreshed","element:child:jsRefresh":"onDescendantJSRefreshed","before:element:child:destroy":"onBeforeDescendantDestroyed","element:child:destroy":"onDescendantDestroyed","before:navigation:reorder":"stopEventPropagation","navigation:reorder":"onReorder"},onReorder:function(e,cid,index,oldIndex){var view=this.children.findByModelCid(cid);var otherView=this.children.find(function(childView){return childView.model.get("order")==index});if(oldIndex-index<0){view.$el.insertAfter(otherView.$el)}else{view.$el.insertBefore(otherView.$el)}this.children.each(function(childView){var childIndex=childView.$el.index();childView._index=childIndex;childView.model.set("order",childIndex)});view.model.collection.sort();e.stopPropagation()},onChangeAttributes:_.debounce(function(model,atts){model=this.model.toJSON();model.atts=atts?atts:{};var view=this;view.el.classList.add("is-rendering");window.ajax.send("tailor_render",{data:{model:JSON.stringify(model),nonce:window._nonces.render},success:function(response){view.updateTemplate(response.html);var id=view.model.get("id");app.channel.trigger("css:update",id,response.css)},error:function(response){view.updateTemplate('

    The template for '+view.cid+" could not be refreshed

    ");console.log(response)},complete:function(){var isEditing=view.$el.hasClass("is-editing");var isSelected=view.$el.hasClass("is-selected");view.$el.removeClass("is-rendering");view.triggerAll("before:element:refresh",view,model.atts);view.renderTemplate();view.triggerAll("element:refresh",view,model.atts);if(isEditing){view.$el.addClass("is-editing")}if(isSelected){view.$el.addClass("is-selected")}}})},250),onChangeOrder:function(){this.triggerAll("element:change:order",this)},onChangeParent:function(){this.triggerAll("element:change:parent",this)},onChangeSetting:function(setting,refresh){if(refresh){this.triggerAll("before:element:jsRefresh",this,this.model.get("atts"));app.channel.trigger("element:setting:change",setting,this);this.triggerAll("element:jsRefresh",this,this.model.get("atts"))}},initialize:function(){this._isReady=false;this._isBeingDestroyed=false;this.options.childViewContainer=this.model.get("child_container")||null;this.addEventListeners()},addEventListeners:function(){this.listenTo(app.channel,"before:elements:restore",this.onBeforeDestroy)},getChildView:function(child){return Tailor.lookup(child.get("tag"),child.get("type"),"Views")},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return child.get("parent")===this.model.get("id")},attachElContent:function(html){var $el=jQuery(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("draggable",true);this.el.setAttribute("tailor-label",this.model.get("label"));this.el.classList.add("tailor-"+this.model.cid);this.el.title=_l10n.edit_element;return this},getTemplateId:function(){return"tmpl-tailor-"+this.model.get("id")},getTemplate:function(){var el=document.querySelector("#"+this.getTemplateId());var template;if(el){template=_.template(el.innerHTML);el.parentElement.removeChild(el)}else{el=document.querySelector("#tmpl-tailor-"+this.model.get("tag")+"-default");template=_.template(el.innerHTML)}return template},updateTemplate:function(html){var templateId=this.getTemplateId();var el=document.querySelector("#"+templateId);if(!el){el=document.createElement("script");el.setAttribute("type","text/html");el.id=templateId;document.body.appendChild(el)}el.innerHTML=html},renderTemplate:function(){this._ensureViewIsIntact();var $childViewContainer=this.getChildViewContainer(this);var $children=$childViewContainer.contents().detach();this.resetChildViewContainer();this._renderTemplate();$childViewContainer=this.getChildViewContainer(this);$childViewContainer.append($children);return this},onBeforeRender:function(){this.triggerAll("before:element:ready",this)},onDomRefresh:function(){this.$el.find("a").attr({draggable:false,target:"_blank"});this.$el.find("img").attr({draggable:false})},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this)},onDestroy:function(){this.triggerAll("element:destroy",this)},beforeChildElementReady:function(childView){if(this._isReady&&this.children.contains(childView)){this.triggerAll("before:element:child:ready",childView)}},childElementReady:function(childView){if(this.children.contains(childView)){if(!this._isReady){var readyChildren=this.children.filter(function(childView){return childView._isReady}).length;if(this.children.length==readyChildren){this._isReady=true;this.triggerAll("element:ready",this)}}else{this.triggerAll("element:child:ready",childView)}}},beforeChildElementRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("before:element:child:refresh",childView)}},childElementRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:refresh",childView)}},beforeChildElementJSRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("before:element:child:jsRefresh",childView)}},childElementJSRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:jsRefresh",childView)}},childElementChangeOrder:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:change:order",childView)}},childElementChangeParent:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:change:parent",childView)}},beforeChildElementDestroyed:function(childView){if(!this._isBeingDestroyed){this.triggerAll("before:element:child:destroy",childView)}},childElementDestroyed:function(childView){if(!this._isBeingDestroyed){this.triggerAll("element:child:destroy",childView)}},onDescendantAdded:function(e,view){this.triggerAll("element:descendant:add",view);e.stopPropagation()},onDescendantRemoved:function(e,view){this.triggerAll("element:descendant:remove",view);e.stopPropagation()},onBeforeDescendantReady:function(e,view){this.triggerAll("before:element:descendant:ready",view);e.stopPropagation()},onDescendantReady:function(e,view){this.triggerAll("element:descendant:ready",view);e.stopPropagation()},onBeforeDescendantRefreshed:function(e,view){this.triggerAll("before:element:descendant:refresh",view);e.stopPropagation()},onDescendantRefreshed:function(e,view){this.triggerAll("element:descendant:refresh",view);e.stopPropagation()},onBeforeDescendantJSRefreshed:function(e,view){this.triggerAll("before:element:descendant:jsRefresh",view);e.stopPropagation()},onDescendantJSRefreshed:function(e,view){this.triggerAll("element:descendant:jsRefresh",view);e.stopPropagation()},onDescendantChangeOrder:function(e,view){this.triggerAll("element:descendant:change:order",view);e.stopPropagation()},onDescendantChangeParent:function(e,view){this.triggerAll("element:descendant:change:parent",view);e.stopPropagation()},onBeforeDescendantDestroyed:function(e,view){this.triggerAll("before:element:descendant:destroy",view);e.stopPropagation()},onDescendantDestroyed:function(e,view){this.triggerAll("element:descendant:destroy",view);e.stopPropagation()},stopEventPropagation:function(e){e.stopPropagation()},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}},_updateIndices:function(view,increment,index){if(increment){view._index=index;view.model._changing=false;view.model.set("order",index)}this.children.each(function(laterView){if(laterView._index>=view._index){laterView._index+=increment?1:-1; laterView.model.set("order",laterView._index)}},this)}});module.exports=CompositeView},{}],18:[function(require,module,exports){var $=window.jQuery,ElementView;ElementView=Marionette.ItemView.extend({className:"element",attributes:{draggable:true},behaviors:{Draggable:{},Droppable:{},Editable:{},Movable:{}},modelEvents:{"change:atts":"onChangeAttributes","change:parent":"onChangeParent","change:setting":"onChangeSetting"},initialize:function(){this._isReady=false;this._isBeingDestroyed=false;this.addEventListeners()},addEventListeners:function(){this.listenTo(app.channel,"before:elements:restore",this.onBeforeDestroy)},getTemplateId:function(){return"tmpl-tailor-"+this.model.get("id")},getTemplate:function(){var el=document.querySelector("#"+this.getTemplateId());var template;if(el){template=_.template(el.innerHTML);el.parentElement.removeChild(el)}else{el=document.querySelector("#tmpl-tailor-"+this.model.get("tag")+"-default");template=_.template(el.innerHTML)}return template},attachElContent:function(html){var $el=$(html);var el=$el[0];this.$el.replaceWith(el);this.setElement(el);this.el.setAttribute("draggable",true);this.el.setAttribute("tailor-label",this.model.get("label"));this.el.classList.add("tailor-"+this.model.id);this.el.title=_l10n.edit_element;return this},updateTemplate:function(html){var templateId=this.getTemplateId();var el=document.querySelector("#"+templateId);if(!el){el=document.createElement("script");el.setAttribute("type","text/html");el.id=templateId;document.body.appendChild(el)}el.innerHTML=html},onChangeAttributes:_.debounce(function(model,atts){var view=this;model=model.toJSON();if(atts){model.atts=atts}view.el.classList.add("is-rendering");window.ajax.send("tailor_render",{data:{model:JSON.stringify(model),nonce:window._nonces.render},success:function(response){view.updateTemplate(response.html);app.channel.trigger("css:update",view.model.get("id"),response.css)},error:function(response){view.updateTemplate('

    The template for '+view.cid+" could not be refreshed

    ");console.log(response)},complete:function(){var isEditing=view.$el.hasClass("is-editing");var isSelected=view.$el.hasClass("is-selected");view.$el.removeClass("is-rendering");view.triggerAll("before:element:refresh",view,model.atts);view.render();view.triggerAll("element:refresh",view,model.atts);if(isEditing){view.$el.addClass("is-editing")}if(isSelected){view.$el.addClass("is-selected")}}})},500),onChangeSetting:function(setting,refresh){if(refresh){this.triggerAll("before:element:jsRefresh",this,this.model.get("atts"));app.channel.trigger("element:setting:change",setting,this);this.triggerAll("element:jsRefresh",this,this.model.get("atts"))}},onChangeParent:function(){this.triggerAll("element:change:parent",this)},onBeforeRender:function(){this.triggerAll("before:element:ready",this)},onDomRefresh:function(){var view=this;this.$el.find("a").attr({draggable:false,target:"_blank"});this.$el.find("[onchange]").removeAttr("onchange");this.$el.find("img").attr({draggable:false});this.$el.imagesLoaded(function(){view._isReady=true;if(view.el.classList.contains("tailor-widget")&&0==view.$el.children().innerHeight()){var el=document.querySelector("#tmpl-tailor-element-empty");if(el){view.$el.html(el.innerHTML)}}view.triggerAll("element:ready",view)})},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this)},onDestroy:function(){this.triggerAll("element:destroy",this)},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}}});module.exports=ElementView},{}],19:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Carousel;Carousel=Components.create({slickActive:false,getDefaults:function(){return{items:".tailor-carousel__item",prevArrow:'',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:true,fade:false}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.slick()},slick:function(){var component=this;component.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){this.$wrap.slick("refresh")},unSlick:function(){this.$wrap.slick("unslick")},onMove:function(){if(this.slickActive){this.refreshSlick()}},onBeforeCopy:function(){if(this.slickActive){this.unSlick()}},onCopy:function(){if(!this.slickActive){this.slick()}},onBeforeRefresh:function(){if(this.slickActive){this.unSlick()}},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){if(this.slickActive){this.unSlick()}},onResize:function(){if(this.slickActive){this.refreshSlick()}}});$.fn.tailorSimpleCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSimpleCarousel");if(!instance){$.data(this,"tailorSimpleCarousel",new Carousel(this,options,callbacks))}})}},{}],20:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Carousel;Carousel=Components.create({getDefaults:function(){return{items:".tailor-carousel__item",prevArrow:'',nextArrow:'',adaptiveHeight:false,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,initialSlide:0,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:false,infinite:false}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.slickAt(0,this.addEventListeners)},slickAt:function(index,callback){this.querySelectors();var numberItems=this.$items.length;if(!numberItems){return}index=Math.min(index,numberItems-1);if(index "+component.options.items);component.$dots=component.$el.children(".slick-dots").find(" > li");component.$dots.on("click",function(e){var $dot=$(e.currentTarget);component.currentSlide=$dot.data("id");component.$wrap.slick("slickGoTo",$dot.index());e.preventDefault()});if(!component.currentSlide){var $activeSlide=component.$items.filter(function(){return this.classList.contains("slick-current")});component.currentSlide=$activeSlide.length?$activeSlide.id:component.$items[0].id}},updateDots:function(index){this.$dots.each(function(i,el){if(index==i){el.classList.add("slick-active")}else{el.classList.remove("slick-active")}});this.$dots.toggle(this.$dots.length/this.options.slidesToShow>1)},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onBeforeRefresh:function(){this.unSlick()},onRefresh:function(){this.refreshSlick()},onJSRefresh:function(){this.refreshSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onAddChild:function(){this.refreshSlick()},onRemoveChild:function(e,childView){childView.$el.detach();this.refreshSlick()},onBeforeReadyChild:function(e,childView){this.unSlick()},onReadyChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeReorderChild:function(){this.unSlick()},onReorderChild:function(e,cid,index,oldIndex){this.querySelectors();this.slickAt(index)},onBeforeRefreshChild:function(){this.unSlick()},onRefreshChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeJSRefreshChild:function(){this.unSlick()},onJSRefreshChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeDestroyChild:function(){this.unSlick()},onDestroyChild:function(e,childView){var index=childView.$el.index();childView.$el.remove();this.slickAt(index)},onAddDescendant:function(){this.refreshSlick()},onRemoveDescendant:function(){this.refreshSlick()},onReadyDescendant:function(){this.refreshSlick()},onRefreshDescendant:function(){this.refreshSlick()},onJSRefreshDescendant:function(){this.refreshSlick()},onDestroyDescendant:function(){this.refreshSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorCarousel");if(!instance){$.data(this,"tailorCarousel",new Carousel(this,options,callbacks))}})}},{}],21:[function(require,module,exports){var ElementCollection=Backbone.Collection.extend({comparator:"order",model:function(attrs,options){var Model=Tailor.lookup(attrs.tag,attrs.type,"Models");return new Model(attrs,options)},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"change:parent",this.onChangeParent);this.listenTo(this,"add",this.onAdd);this.listenTo(this,"destroy",this.onDestroy);this.listenTo(this,"container:collapse",this.onCollapse);this.listenTo(this,"reset",this.onReset)},getElementDefinitions:function(){return this.library||app.channel.request("sidebar:library")},applyDefaults:function(model){if(model instanceof Backbone.Model){model=model.toJSON()}var item=this.getElementDefinitions().findWhere({tag:model.tag});var defaults={label:item.get("label"),type:item.get("type")};var child=item.get("child");if(child){defaults.child=child}var childViewContainer=item.get("child_container");if(childViewContainer){defaults.child_container=childViewContainer}model.atts=model.atts||{};_.each(item.get("settings"),function(setting){if(!_.isEmpty(setting["value"])&&!model.atts.hasOwnProperty(setting["id"])){model.atts[setting["id"]]=setting["value"]}});return _.extend(model,defaults)},getParent:function(model){return this.findWhere({id:model.get("parent")})},getChildren:function(model){return this.where({parent:model.get("id")})},getSiblings:function(model){return this.where({parent:model.get("parent")})},hasSelectedParent:function(model){var selected=app.channel.request("canvas:element:selected");if(!selected||model===selected){return false}var parentId=model.get("parent");var parent=this.findWhere({id:parentId});while("undefined"!==typeof parent){if(selected===parent){return true}parentId=parent.get("parent");parent=this.get(parentId)}return false},onChangeParent:function(model){var parent=this.get(model.get("parent"));var previousParent=this.get(model.previous("parent"));this.sort({silent:true});this._checkParent(previousParent);if("tailor_column"===model.get("tag")){this._reBalanceColumns(parent);this._reBalanceColumns(previousParent)}},onAdd:function(model,collection,options){if("tailor_column"==model.get("tag")){this._reBalanceColumns(this.get(model.get("parent")))}},onDestroy:function(model){var parent=this.get(model.get("parent"));this._checkParent(parent);var children=this.where({parent:model.get("id")});if(children.length){_.each(children,function(child){child.trigger("destroy",child,this)},this)}if(parent&&"tailor_column"===model.get("tag")){this._reBalanceColumns(parent)}if(0===this.length){this.onEmpty()}},onReset:function(){if(0===this.length){this.onEmpty()}},onEmpty:function(){var section=this.createSection(0);this.create([{tag:"tailor_content",atts:{},parent:section.get("id"),order:0}])},onCollapse:function(model,children){var parentId=model.get("parent");_.each(children,function(child){child.set("parent",parentId)},this)},add:function(models,options){if(_.isArray(models)){_.each(models,this.applyDefaults.bind(this))}else{this.applyDefaults(models)}return this.set(models,_.extend({merge:false},options,{add:true,remove:false}))},create:function(models,options){options=options||{};return this.add(models,options)},createSection:function(order){return _.first(this.create([{tag:"tailor_section",order:order}],{at:order}))},createRow:function(parentId,order){var row=_.first(this.create([{tag:"tailor_row",parent:parentId,order:order}],{}));return this.create([{tag:"tailor_column",atts:{width:"50%"},parent:row.get("id"),order:0},{tag:"tailor_column",atts:{width:"50%"},parent:row.get("id"),order:1}])},createColumn:function(parentId,order){return _.first(this.create([{tag:"tailor_column",parent:parentId,order:order}]))},createContainer:function(model,parentId,order,descendants){var tag=model.get("tag");var container=_.first(this.create([{tag:tag,parent:parentId,order:order}],{at:order,silent:true}));var childTag=model.get("child");var children=this.create([{tag:childTag,parent:container.get("id"),order:0},{tag:childTag,parent:container.get("id"),order:1}],{silent:true});if(descendants){_.first(descendants).set("parent",_.first(children).get("id"),{silent:true});_.last(descendants).set("parent",_.last(children).get("id"),{silent:true})}this.trigger("add",container,this,{})},createWrapper:function(tag,parentId,order,child){var wrapper=_.first(this.create([{tag:tag,parent:parentId,order:order}],{silent:true}));if("undefined"==typeof child){this.create([{tag:"tailor_content",parent:wrapper.get("id"),order:0}],{silent:true})}this.trigger("add",wrapper,this,{});if("undefined"!=typeof child){this.insertChild(child,wrapper)}return wrapper},createChild:function(model){var child=_.first(this.create([{tag:model.get("child"),parent:model.get("id"),order:this.getChildren(model).length}],{silent:true}));this.create([{tag:"tailor_content",parent:child.get("id"),order:0}],{silent:true});this.trigger("add",child,this,{});return child},insertChild:function(child,parent){if(!child){return}if(child.get("parent")!==parent.get("id")){child.trigger("remove:child")}parent.trigger("insert",child);child.trigger("add:child");child.set("parent",parent.get("id"))},_reBalanceColumns:function(model){var children=this.where({parent:model.get("id")});var numberChildren=children.length;_.each(children,function(child){var atts=_.clone(child.get("atts"));atts["width"]=Math.round(parseFloat(1/numberChildren)*1e3)/10+"%";delete atts["width_tablet"];delete atts["width_mobile"];child.set("atts",atts,{silent:true});child.trigger("change:width",child,atts)},this)},_checkParent:function(model){if(!model){return}if("container"==model.get("type")){this._checkCollapsibleContainer(model)}this._checkChildren(model)},_checkChildren:function(model){var children=this.where({parent:model.get("id")});if(0===children.length){model.trigger("destroy",model)}},_checkCollapsibleContainer:function(model){var childTag=this.getElementDefinitions().findWhere({tag:model.get("tag")}).get("child");var containerId=model.get("id");var children=this.filter(function(element){return containerId===element.get("parent")&&childTag===element.get("tag")});if(0===children.length){model.trigger("container:collapse",model,this.where({parent:containerId}))}else if(1===children.length){var child=_.first(children);if("tailor_row"===model.get("tag")){child.trigger("container:collapse",child,this.where({parent:child.get("id")}))}}}});module.exports=ElementCollection},{}],22:[function(require,module,exports){var ChildModel=require("./../element-child"),ColumnModel;ColumnModel=ChildModel.extend({validTarget:function(that,region){if(_.contains(["tailor_section","tailor_row"],that.get("tag"))||!_.contains(["left","right"],region)){return false}if("child"==that.get("type")&&that.get("tag")!=this.get("tag")){return false}var siblings=this.collection.getSiblings(this);return that.get("parent")==this.get("parent")||siblings.length<6}});module.exports=ColumnModel},{"./../element-child":28}],23:[function(require,module,exports){var ChildModel=require("./../element-child"),GridItemModel;GridItemModel=ChildModel.extend({validTarget:function(that,region){if("tailor_section"==that.get("tag")||_.contains(["top","bottom","center"],region)){return false}var parent=this.collection.getParent(this);if(parent.get("tag")==that.get("tag")){return false}return that.get("tag")==this.get("tag")}});module.exports=GridItemModel},{"./../element-child":28}],24:[function(require,module,exports){var ContainerModel=require("./../element-container"),CarouselModel;CarouselModel=ContainerModel.extend({createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();var $navigation=view.$el.find(".slick-dots").detach();this.appendTemplate(id,view);$childViewContainer.append($children);$navigation.insertAfter($childViewContainer);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=CarouselModel},{"./../element-container":30}],25:[function(require,module,exports){var ContainerModel=require("./../element-container"),RowModel;RowModel=ContainerModel.extend({validTarget:function(that,region){if("child"==that.get("type")||"tailor_section"==that.get("tag")||"center"==region){return false}return _.contains(["top","bottom"],region)&&"tailor_column"!=that.get("tag")}});module.exports=RowModel},{"./../element-container":30}],26:[function(require,module,exports){var ContainerModel=require("./../element-container"),TabsModel;TabsModel=ContainerModel.extend({createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();var $navigation=view.$el.find(".tailor-tabs__navigation");var $navigationItems=$navigation.children().detach();this.appendTemplate(id,view);$childViewContainer.append($children);$navigation.append($navigationItems);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=TabsModel},{"./../element-container":30}],27:[function(require,module,exports){var Model;Backbone.Model.prototype.set=_.wrap(Backbone.Model.prototype.set,function(oldSet,key,val,options){if(key==null)return this;var attrs;if(typeof key==="object"){attrs=key;options=val}else{(attrs={})[key]=val}options||(options={});var ret=oldSet.call(this,attrs,options);if(this._tracking){_.each(attrs,_.bind(function(val,key){if(_.isEqual(this._original[key],val)){delete this._unsaved[key]}else{this._unsaved[key]=val}},this))}return ret});Model=Backbone.Model.extend({_tracking:false,_original:{},_unsaved:{},defaults:function(){return{id:this.cid,tag:"",label:"",atts:{},parent:"",order:0,collection:"element"}},isTracking:function(){return this._tracking},startTracking:function(){this._tracking=true;this.resetTracking();return this},stopTracking:function(){this._tracking=false;this._original={};this._unsaved={};return this},resetTracking:function(){this._original=_.clone(this.attributes);this._unsaved={};return this},resetAttributes:function(){if(!this._tracking){return}this.attributes=this._original;this.resetTracking();this.trigger("change:atts",this,this.get("atts"));return this},toShortcode:function(){var tag=this.get("tag");var atts=this.get("atts");var content="";var shortcode="["+tag;_.each(atts,function(attr,id){if(attr){if("content"===id){content=attr}else{if(_.isNumber(id)){if(/\s/.test(attr)){shortcode+=' "'+attr+'"'}else{shortcode+=" "+attr}}else{shortcode+=" "+id+'="'+attr+'"'}}}},this);return shortcode+"]"+content+"[/"+tag+"]"},insertBefore:function(view){this.trigger("remove:child");this.trigger("insert:before",view);this.trigger("add:child");this.set("parent",view.model.get("parent"))},insertAfter:function(view){this.trigger("remove:child");this.trigger("insert:after",view);this.trigger("add:child");this.set("parent",view.model.get("parent"))},columnBefore:function(view){var model=view.model;var parent=model.get("parent");if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(parent,model.get("order")-1);this.collection.insertChild(this,column)}else{var columns=this.collection.createRow(parent,model.get("order"));this.collection.insertChild(this,_.first(columns));this.collection.insertChild(model,_.last(columns))}},columnAfter:function(view){var model=view.model;var parent=model.get("parent");if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(parent,model.get("order"));this.collection.insertChild(this,column)}else{var columns=this.collection.createRow(parent,model.get("order"));this.collection.insertChild(model,_.first(columns));this.collection.insertChild(this,_.last(columns))}},beforeCopyElement:function(view){var el=view.el;view.triggerAll("before:element:copy",view);el.classList.remove("is-dragging");el.classList.remove("is-hovering");el.classList.remove("is-selected");el.classList.remove("is-editing")},appendTemplate:function(id,view){var oldId=view.model.get("id");var template=document.createElement("script");template.setAttribute("type","text/html");template.id="tmpl-tailor-"+id;template.innerHTML=view.el.outerHTML.replace(oldId,id);document.body.appendChild(template)},afterCopyElement:function(id,view){var oldId=view.model.get("id");view.$el.trigger("element:copy",view);app.channel.trigger("css:copy",oldId,id)}});module.exports=Model},{}],28:[function(require,module,exports){var CompositeModel=require("./element-composite"),ChildModel;ChildModel=CompositeModel.extend({validTarget:function(that,region){if("tailor_section"==that.get("tag")||_.contains(["left","right","center"],region)){return false}var parent=this.collection.getParent(this);if(parent.get("tag")==that.get("tag")){return false}return that.get("tag")==this.get("tag")},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.insertBefore);this.listenTo(this,"element:move:right",this.insertAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyBefore);this.listenTo(this,"element:copy:right",this.copyAfter)}});module.exports=ChildModel},{"./element-composite":29}],29:[function(require,module,exports){var BaseModel=require("./element-base"),CompositeModel;CompositeModel=BaseModel.extend({cloneContainer:function(sourceView,parent,index){var collection=this.collection;var clone=sourceView.model.clone();clone.set("id",clone.cid);clone.set("parent",parent);clone.set("order",index);this.createTemplate(clone.cid,sourceView);var clonedChildren=this.cloneChildren(sourceView.children,clone,[]);collection.add(clonedChildren,{silent:true});collection.add(clone);sourceView.triggerMethod("element:refresh")},cloneChildren:function(childViews,parent,clones){if(childViews.length){childViews.each(function(childView){var clone=childView.model.clone();clone.set("id",clone.cid);clone.set("parent",parent.get("id"));clone.createTemplate(clone.cid,childView);clones.push(clone);if(childView.children){this.cloneChildren(childView.children,clone,clones)}},this)}return clones},copyBefore:function(targetView,sourceView){this.cloneContainer(sourceView,targetView.model.get("parent"),targetView.model.get("order")-1)},copyAfter:function(targetView,sourceView){this.cloneContainer(sourceView,targetView.model.get("parent"),targetView.model.get("order"))},copyColumnBefore:function(targetView,sourceView){var parent=targetView.model.get("parent");if("tailor_column"===targetView.model.get("tag")){var column=this.collection.createColumn(parent,targetView.model.get("order")-1);this.cloneContainer(sourceView,column.get("id"),0)}else{var columns=this.collection.createRow(parent,targetView.model.get("order"));this.collection.insertChild(targetView.model,_.last(columns));this.cloneContainer(sourceView,_.first(columns).get("id"),0)}},copyColumnAfter:function(targetView,sourceView){var parent=targetView.model.get("parent");if("tailor_column"===targetView.model.get("tag")){var column=this.collection.createColumn(parent,targetView.model.get("order"));this.cloneContainer(sourceView,column.get("id"),0)}else{var columns=this.collection.createRow(parent,targetView.model.get("order"));this.collection.insertChild(targetView.model,_.first(columns));this.cloneContainer(sourceView,_.last(columns).get("id"),0)}},createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();this.appendTemplate(id,view);$childViewContainer.append($children);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=CompositeModel},{"./element-base":27}],30:[function(require,module,exports){var CompositeModel=require("./element-composite"),ContainerModel;ContainerModel=CompositeModel.extend({validTarget:function(that,region){if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("center"==region){return"container"!=that.get("type")}if(_.contains(["wrapper","child"],parent.get("type"))){if(_.contains(["top","bottom"],region)){return _.contains(["tailor_section","tailor_column"],parent.get("tag"))||!_.contains(["container","wrapper","child"],that.get("type"))}return"tailor_section"==parent.get("tag")||!_.contains(["left","right"],region)}return"container"!=that.get("type")},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter)}});module.exports=ContainerModel},{"./element-composite":29}],31:[function(require,module,exports){var CompositeModel=require("./element-composite"),WrapperModel;WrapperModel=CompositeModel.extend({validTarget:function(that,region){if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))||"center"==region){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("child"==parent.get("type")&&"tailor_column"!=parent.get("tag")){return"container"!=that.get("type")&&!_.contains(["left","right"],region)}if(_.contains(["container","wrapper","child"],parent.get("type"))){return"tailor_section"==parent.get("tag")||!_.contains(["left","right"],region)}return true},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter);this.listenTo(this,"element:move:center",this.createChild);this.listenTo(this,"element:copy:center",this.copyChild)},createChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;this.createTemplate(sourceView.model.get("id"),sourceView);this.collection.createWrapper(childTag,id,numberChildren,sourceView.model)},copyChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;var wrapper=this.collection.createWrapper(childTag,id,numberChildren,false);this.cloneContainer(sourceView,wrapper.get("id"),0)}});module.exports=WrapperModel},{"./element-composite":29}],32:[function(require,module,exports){var BaseModel=require("./element-base"),ElementModel;ElementModel=BaseModel.extend({validTarget:function(that,region,threshold){if(threshold<20){return false}if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))||"center"==region){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("child"==parent.get("type")&&"tailor_column"!=parent.get("tag")){return"container"!=that.get("type")&&!_.contains(["left","right"],region)}if(_.contains(["wrapper","child"],parent.get("type"))){if(_.contains(["top","bottom"],region)){return _.contains(["tailor_section","tailor_column"],parent.get("tag"))||!_.contains(["container","wrapper","child"],that.get("type"))}return"tailor_section"==parent.get("tag")||_.contains(["left","right"],region)}return true},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter);this.listenTo(this,"element:move:center",this.createChild);this.listenTo(this,"element:copy:center",this.copyChild)},copyBefore:function(targetView,sourceView){var clone=sourceView.model.clone();var index=targetView.model.get("order")-1;clone.set("id",clone.cid);clone.set("parent",targetView.model.get("parent"));clone.set("order",index);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},copyAfter:function(targetView,sourceView){var clone=sourceView.model.clone();var index=targetView.model.get("order");clone.set("id",clone.cid);clone.set("parent",targetView.model.get("parent"));clone.set("order",index);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},copyColumnBefore:function(targetView,sourceView){var model=targetView.model;var clone=sourceView.model.clone();clone.set("id",clone.cid);this.createTemplate(clone.cid,sourceView);if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(model.get("parent"),model.get("order")-1);clone.set("parent",column.get("id"));this.collection.add(clone)}else{var columns=this.collection.createRow(model.get("parent"),model.get("order"));this.collection.insertChild(model,_.last(columns));clone.set("parent",_.first(columns).get("id"));this.collection.add(clone)}},copyColumnAfter:function(targetView,sourceView){var model=targetView.model;var clone=sourceView.model.clone(); clone.set("id",clone.cid);this.createTemplate(clone.cid,sourceView);if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(model.get("parent"),model.get("order"));clone.set("parent",column.get("id"));this.collection.add(clone)}else{var columns=this.collection.createRow(model.get("parent"),model.get("order"));this.collection.insertChild(model,_.first(columns));clone.set("parent",_.last(columns).get("id"));this.collection.add(clone)}},createChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;this.appendTemplate(sourceView.model.get("id"),sourceView);this.collection.createWrapper(childTag,id,numberChildren,sourceView.model)},copyChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;var wrapper=this.collection.createWrapper(childTag,id,numberChildren,false);var clone=sourceView.model.clone();clone.set("id",clone.cid);clone.set("parent",wrapper.get("id"));clone.set("order",0);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);this.appendTemplate(id,view);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=ElementModel},{"./element-base":27}],33:[function(require,module,exports){var WrapperModel=require("./../element-wrapper"),SectionModel;SectionModel=WrapperModel.extend({validTarget:function(that,region){return"tailor_section"==that.get("tag")&&!_.contains(["left","right","center"],region)}});module.exports=SectionModel},{"./../element-wrapper":31}],34:[function(require,module,exports){var CanvasRegion=Backbone.Marionette.Region.extend({initialize:function(){this.listenTo(app.channel,"canvas:dragstart",this.onDragStart);this.listenTo(app.channel,"canvas:dragend",this.onDragEnd)},onDragStart:function(view,region,options){this.el.classList.add("is-active")},onDragEnd:function(view,region,options){this.el.classList.remove("is-active")}});module.exports=CanvasRegion},{}],35:[function(require,module,exports){var $=Backbone.$,$win=$(window),$doc=$(document),CanvasCollectionView=require("./show/canvas-view"),CanvasModule;CanvasModule=Marionette.Module.extend({onStart:function(){this._model=null;this._isDragging=false;this.collection=app.channel.request("canvas:elements");this.addEventListeners();this.showCanvas();app.channel.trigger("module:canvas:ready",this)},addEventListeners:function(){this.listenTo(app.channel,"canvas:dragstart",this.onDragStart);this.listenTo(app.channel,"canvas:dragover",this.onDragOver);this.listenTo(app.channel,"canvas:dragend",this.onDragEnd);this.listenTo(app.channel,"canvas:drop",this.onDrop);$doc.on("click dragover",this.reset.bind(this));$win.on("resize",this.reset.bind(this))},showCanvas:function(){app.canvasRegion.show(new CanvasCollectionView({collection:this.collection}))},onDragStart:function(e,view){var collection=view.model.collection;if("function"===typeof collection.hasSelectedParent&&collection.hasSelectedParent(view.model)){return}this._view=view;this._model=view.model;this._isDragging=true;view.el.classList.add("is-dragging");if("element"==view.model.get("collection")){var testVar=window.DataTransfer||window.Clipboard;if("setDragImage"in testVar.prototype){var dragImage=document.createElement("img");dragImage.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";e.dataTransfer.setDragImage(dragImage,0,0)}}e.dataTransfer.effectAllowed="copyMove";e.dataTransfer.setData("Text",this._model.cid);e.stopPropagation()},onDragOver:function(e,view){if(!this._isDragging){return}if(e.pageY){var scrollY=window.scrollY||document.documentElement.scrollTop;if(e.pageY-scrollY<40){window.scrollTo(0,scrollY-20)}else if(scrollY+window.innerHeight-e.pageY<40){window.scrollTo(0,scrollY+20)}}var action="element"===this._model.get("collection")&&e.shiftKey?"copy":"move";if("move"===action&&view.model===this._model){this.reset();e.stopPropagation();return}var region=this._getDropRegion(e,view);if(!view.model.validTarget(this._model,region)){return}e.dataTransfer.dropEffect=action;app.channel.trigger("canvas:guide",view,region);e.preventDefault();e.stopPropagation()},onDrop:function(e,view){if(!this._isDragging){return}var model=this._model;var region=this._getDropRegion(e,view);if(!view.model.validTarget(model,region)){return}var action;if("element"===model.get("collection")){action=e.shiftKey?"copy":"move";if("move"===action&&view.model===model){return}}else{action="add"}model.trigger("element:"+action+":"+region,view,this._view);app.channel.trigger("element:"+action,model);this.collection.sort({silent:true});e.preventDefault();e.stopPropagation()},onDragEnd:function(e,view){if(!this._isDragging){return}this._isDragging=false;this._view.el.classList.remove("is-dragging");this.reset()},reset:function(){app.channel.trigger("canvas:reset")},_getPoint:function(e){if(e.targetTouches){return{x:e.targetTouches[0].clientX,y:e.targetTouches[0].clientY}}return{x:e.clientX,y:e.clientY}},_getDropRegion:function(e,view){var point=this._getPoint(e);var rect=view.el.getBoundingClientRect();var width=rect.width/2;var height=rect.height/2;var top=rect.top+(rect.height-height)/2;var left=rect.left+(rect.width-width)/2;if(left<=point.x&&point.x<=left+width&&top<=point.y&&point.y<=top+height){return"center"}else{var x=(point.x-(rect.left+width))/width;var y=(point.y-(rect.top+height))/height;if(Math.abs(x)>Math.abs(y)){return x>0?"right":"left"}return y>0?"bottom":"top"}}});module.exports=CanvasModule},{"./show/canvas-view":36}],36:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({behaviors:{Container:{}},getChildView:function(){return Tailor.lookup("tailor_section","wrapper","Views")},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return!child.get("parent")},_updateIndices:function(view,increment,index){if(increment){view._index=index;view.model._changing=false;view.model.set("order",index)}this.children.each(function(laterView){if(laterView._index>=view._index){laterView._index+=increment?1:-1;laterView.model.set("order",laterView._index)}},this)},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}}})},{}],37:[function(require,module,exports){var Stylesheet=require("./stylesheet"),CSSModule;CSSModule=Marionette.Module.extend({onStart:function(options){this.stylesheets=[];this.collection=app.channel.request("canvas:elements");this.createSheets(options.mediaQueries||{});this.addRules(options.cssRules||{});this.addEventListeners();app.channel.trigger("module:css:ready",this)},addEventListeners:function(){this.listenTo(app.channel,"css:add",this.addRules);this.listenTo(app.channel,"css:delete",this.deleteRules);this.listenTo(app.channel,"css:update",this.updateRules);this.listenTo(app.channel,"css:copy",this.copyRules);this.listenTo(app.channel,"css:clear",this.clearRules);this.listenTo(this.collection,"destroy",this.onDestroy)},createSheet:function(id,min,max){var media="only screen";if(min){media+=" and (min-width: "+min+")"}if(max){media+=" and (max-width: "+max+")"}return new Stylesheet(id,media)},createSheets:function(mediaQueries){_.each(mediaQueries,function(atts,id){if(!_.isEmpty(atts.min)){if(!_.isEmpty(atts.max)){this.stylesheets[id+"-up"]=this.createSheet(id+"-up",atts.min);this.stylesheets[id]=this.createSheet(id,atts.min,atts.max)}else{this.stylesheets[id]=this.createSheet(id,atts.min)}}else{if(!_.isEmpty(atts.max)){this.stylesheets[id]=this.createSheet(id,null,atts.max)}else{this.stylesheets[id]=this.createSheet(id)}}},this);app.channel.trigger("module:css:stylesheets:ready",this)},getSheet:function(id){if(this.stylesheets.hasOwnProperty(id)){return this.stylesheets[id]}return false},addRules:function(cssRules){for(var queryId in cssRules){if(cssRules.hasOwnProperty(queryId)){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].addRules(cssRules[queryId])}}}},clearRules:function(){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].clearRules()}}},copyRules:function(elementId,newElementId){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){var rules=this.stylesheets[queryId].getRules(elementId);if(rules.length){for(var rule in rules){if(rules.hasOwnProperty(rule)){rules[rule].selectors=rules[rule].selectors.replace(new RegExp(elementId,"g"),newElementId)}}var rulesSet={};rulesSet[queryId]={};rulesSet[queryId][newElementId]=rules;this.addRules(rulesSet)}}}},deleteRules:function(elementId,settingId){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].deleteRules(elementId,settingId)}}},updateRules:function(elementId,cssRules){this.deleteRules(elementId);this.addRules(cssRules)},onReset:function(){this.clearRules()},onDestroy:function(model){this.deleteRules(model.get("id"))}});module.exports=CSSModule},{"./stylesheet":38}],38:[function(require,module,exports){function Stylesheet(id,media){this.id=id;this.initialize(media)}Stylesheet.prototype={initialize:function(media){this.stylesheet=this.createStylesheet(media);this.sheet=this.stylesheet.sheet;this.lookup=[]},createStylesheet:function(media){var style=document.createElement("style");style.appendChild(document.createTextNode(""));media=media||"screen";style.setAttribute("media",media);style.setAttribute("id","tailor-"+this.id);document.head.appendChild(style);return style},addRules:function(ruleSet){for(var elementId in ruleSet){if(ruleSet.hasOwnProperty(elementId)){this.lookup=this.lookup||[];for(var i in ruleSet[elementId]){if(ruleSet[elementId].hasOwnProperty(i)){this.addRule(elementId,ruleSet[elementId][i])}}}}},addRule:function(elementId,rule){if(this.checkRule(rule)){var selectors=Tailor.CSS.parseSelectors(rule["selectors"],elementId);var declarations=Tailor.CSS.parseDeclarations(rule["declarations"]);if(!_.isEmpty(declarations)){var settingId=rule["setting"];Tailor.CSS.addRule(this.sheet,selectors,declarations,this.lookup.length);this.lookup.push({elementId:elementId,settingId:settingId})}}},checkRule:function(rule){return _.has(rule,"selectors")&&_.has(rule,"declarations")&&_.has(rule,"setting")},getRules:function(elementId){var rules=[];for(var i=0;i-1){rules.push({selectors:rule.selectorText,declarations:rule.style.cssText,setting:this.lookup[i]["settingId"]||""})}}}return rules},deleteRules:function(elementId,settingId){for(var i=0;i1){module.collection.add(parents,{at:index+1})}else{parents[0].parent=parent;parents[0].order=index;module.collection.add(parents)}app.channel.trigger("template:add",model)}canvas.classList.remove("is-loading")}})}};app.channel.on("template:load",api.loadTemplate);app.channel.trigger("module:templates:ready",this)}});module.exports=TemplateModule},{}],41:[function(require,module,exports){var SelectRegion=Backbone.Marionette.Region.extend({onShow:function(view,region,options){view._view.el.classList.add("is-selected")},onEmpty:function(view,region,options){view._view.el.classList.remove("is-selected")}});module.exports=SelectRegion},{}],42:[function(require,module,exports){var GuideView=Marionette.ItemView.extend({template:false,position:function(view,drop){var $el=view.$el;var offset=$el.offset();var parentOffset=this.$el.offsetParent().offset();this.el.style.visibility="visible";this.el.className="guide guide--"+drop+" guide--"+view.model.get("tag");this.el.style.left=offset.left-parentOffset.left+"px";this.el.style.top=offset.top-parentOffset.top+"px";this.el.style.width=$el.outerWidth()+"px";this.el.style.height=$el.outerHeight()+"px";this.el.style.opacity=1},reset:function(){this.el.style="";this.el.style.visibility="hidden";this.el.style.opacity=0}});module.exports=GuideView},{}],43:[function(require,module,exports){var SelectMenuItemView=Marionette.ItemView.extend({tagName:"div",className:"select__item",events:{click:"onClick"},getTemplate:function(){return _.template("<%= label %>")},onClick:function(e){if(0===this._index){this.triggerMethod("toggle")}else{this.model.trigger("select")}e.stopPropagation()}});module.exports=SelectMenuItemView},{}],44:[function(require,module,exports){var SelectMenuItemView=require("./select-menu-item"),SelectMenuView;SelectMenuView=Marionette.CompositeView.extend({className:"select",childView:SelectMenuItemView,childViewContainer:".select__menu",ui:{add:".js-add",edit:".js-edit",copy:".js-copy",delete:".js-delete"},events:{"click @ui.add":"addElement","click @ui.edit":"editElement","click @ui.copy":"copyElement","click @ui.delete":"deleteElement"},modelEvents:{destroy:"destroy"},childEvents:{toggle:"toggleMenu"},template:"#tmpl-tailor-tools-select",serializeData:function(){var data=Backbone.Marionette.CompositeView.prototype.serializeData.apply(this,arguments);data.type=this.model.get("type");data.siblings=this.collection.where({parent:this.model.get("parent")}).length;return data},initialize:function(options){this._view=options.view},_filteredSortedModels:function(){var models=[];var model=this.model;while("undefined"!==typeof model){models.push(model);model=this.collection.get(model.get("parent"))}return models},onDomRefresh:function(){var thisRect=this.el.parentNode.getBoundingClientRect();var thatRect=this._view.el.getBoundingClientRect();var style=getComputedStyle(this._view.el,null);var borderTop=parseInt(style.getPropertyValue("border-top-width"),10);var borderRight=parseInt(style.getPropertyValue("border-right-width"),10);var borderBottom=parseInt(style.getPropertyValue("border-bottom-width"),10);var borderLeft=parseInt(style.getPropertyValue("border-left-width"),10);var left=Math.round(parseFloat(thatRect.left))+borderLeft;var right=Math.min(window.innerWidth+1,Math.round(thatRect.right)-borderRight);var width=right-left;this.el.style.top=Math.round(parseFloat(thatRect.top-parseFloat(thisRect.top)))+borderTop+"px";this.el.style.left=left-thisRect.left+"px";this.el.style.width=width+"px";this.el.style.height=Math.round(parseFloat(thatRect.height))-borderTop-borderBottom+"px";var controls=this.el.querySelector(".select__controls");var menu=this.el.querySelector(".select__menu");if(menu&&controls){var menuRect=menu.getBoundingClientRect();var controlsRect=controls.getBoundingClientRect();if(menuRect.width+controlsRect.width>parseInt(this.el.style.width,10)){this.el.classList.add("is-minimal")}}},addElement:function(){var child=this.model.collection.createChild(this.model);child.set("collection","library",{silent:true});app.channel.trigger("element:add",child)},editElement:function(){app.channel.trigger("modal:open",this.model)},copyElement:function(){this.model.copyAfter(this._view,this._view);app.channel.trigger("element:copy",this.model)},deleteElement:function(){this.model.trigger("destroy",this.model);app.channel.trigger("element:delete",this.model)},toggleMenu:function(){this.$el.toggleClass("is-expanded")}});module.exports=SelectMenuView},{"./select-menu-item":43}],45:[function(require,module,exports){var GuideView=require("./show/guide"),SelectorView=require("./show/select-menu"),ToolsModule;ToolsModule=Marionette.Module.extend({onStart:function(){var guide=new GuideView({el:"#guide"}).render();var api={positionGuide:function(view,drop){guide.position(view,drop)},selectElement:function(view){app.selectRegion.show(new SelectorView({model:view.model,collection:app.channel.request("canvas:elements"),view:view}))},resetGuide:function(){guide.reset();app.selectRegion.empty()},getSelectedElement:function(){var select=app.selectRegion.currentView;return select?select.model:null}};this.listenTo(app.channel,"canvas:guide",api.positionGuide);this.listenTo(app.channel,"canvas:select",api.selectElement);this.listenTo(app.channel,"canvas:reset",api.resetGuide);this.listenTo(app.channel,"element:refresh:template",api.resetGuide);app.channel.reply("canvas:element:selected",api.getSelectedElement);app.channel.trigger("module:tools:ready",this)}});module.exports=ToolsModule},{"./show/guide":42,"./show/select-menu":44}],46:[function(require,module,exports){require("./preview/helpers");require("./preview/behaviors");require("./preview/css")},{"./preview/behaviors":47,"./preview/css":48,"./preview/helpers":49}],47:[function(require,module,exports){(function($,app,SettingAPI,ElementAPI){ElementAPI.onRender("tailor_carousel",function(atts,model){var carousel=this;var options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:false,fade:"1"==atts.fade&&"1"==atts.items_per_row,slidesToShow:parseInt(atts.items_per_row,10)||1,adaptiveHeight:true};carousel.$el.tailorCarousel(options)});ElementAPI.onRender("tailor_content",function(atts,model){if(this.$el.find(".is-lightbox-image").length>0){this.$el.tailorLightbox({disableOn:function(){return $el.hasClass("is-selected")}})}});ElementAPI.onRender("tailor_gallery",function(atts,model){var $el=this.$el;var options;if("carousel"==atts.layout){options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:"1"==atts.dots,fade:"1"==atts.fade&&"1"==atts.items_per_row,infinite:false,slidesToShow:parseInt(atts.items_per_row,10)||2};$el.tailorSimpleCarousel(options)}else if("slideshow"==atts.layout){options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:false,fade:true,items:".tailor-slideshow__slide",adaptiveHeight:true,draggable:false,speed:250};if("1"==atts.thumbnails){options.customPaging=function(slider,i){var thumb=$(slider.$slides[i]).data("thumb");return''};options.dots=true}$el.tailorSlideshow(options)}else if(atts.masonry){$el.tailorMasonry()}if(this.el.classList.contains("is-lightbox-gallery")){$el.tailorLightbox({disableOn:function(){return $el.hasClass("is-selected")}})}});ElementAPI.onRender("tailor_map",function(atts,model){this.$el.tailorGoogleMap()});ElementAPI.onRender("tailor_posts",function(atts,model){var $el=this.$el;var options;if("carousel"==atts.layout){options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:"1"==atts.dots,fade:"1"==atts.fade&&"1"==atts.items_per_row,infinite:false,slidesToShow:parseInt(atts.items_per_row,10)||2};this.$el.tailorSimpleCarousel(options)}else if(atts.masonry){$el.tailorMasonry()}});ElementAPI.onRender("tailor_section",function(atts,model){if(atts["background_image"]&&atts["parallax"]&&1==atts["parallax"]){this.$el.tailorParallax()}});ElementAPI.onRender("tailor_tabs",function(atts,model){this.$el.tailorTabs()});ElementAPI.onRender("tailor_toggles",function(atts,model){this.$el.tailorToggles()})})(window.jQuery,window.app,window.Tailor.Api.Setting,window.Tailor.Api.Element)},{}],48:[function(require,module,exports){var $=Backbone.$,$win=$(window);(function(window,app,SettingAPI){var cssRules=window._pageRules||[];var cssCollection={_tailor_section_width:"",_tailor_column_spacing:"",_tailor_element_spacing:"",_tailor_page_css:""};var stylesheet=document.createElement("style");stylesheet.appendChild(document.createTextNode(""));stylesheet.setAttribute("media","screen");stylesheet.setAttribute("id","tailor-settings");document.head.appendChild(stylesheet);function getStyleValues(string){var values;if(-1!=string.indexOf(",")){values=string.split(",")}else{values=string.split("-")}if(2==values.length){values=_.object(["top","bottom"],values)}else if(4==values.length){values=_.object(["top","right","bottom","left"],values)}else{values={}}return values}function getMediaQuery(string){var query="";_.each(["_tablet","_mobile"],function(target){if(string.substring(string.length-target.length)==target){query=target.substring(1)}});return query}function generateCSS(settingId,value){cssCollection[settingId]="";value=_.isString(value)?value.trim():value;if(!_.isEmpty(value)){_.each(cssRules[settingId],function(rule){var selectors=Tailor.CSS.parseSelectors(rule.selectors);var declarations=Tailor.CSS.parseDeclarations(rule.declarations).replace(/\{\{(.*?)\}\}/g,value);cssCollection[settingId]+="\n"+selectors+" {"+declarations+"}"})}}function updateStylesheet(){var value="";for(var settingId in cssCollection){if(cssCollection.hasOwnProperty(settingId)){value+=cssCollection[settingId]}}stylesheet.innerHTML=value;$win.trigger("resize")}app.channel.on("module:css:stylesheets:ready",function(cssModule){var settings=app.channel.request("sidebar:settings");if(settings&&settings.length){settings.each(function(setting){var id=setting.get("id");var value=setting.get("value");value=_.isString(value)?value.trim():value;if(!_.isEmpty(value)&&cssCollection.hasOwnProperty(id)){if(cssRules.hasOwnProperty(id)){generateCSS(id,value)}else{cssCollection[id]=value}}})}updateStylesheet();var ids=["_tailor_section_width","_tailor_column_spacing","_tailor_element_spacing"];_.each(ids,function(settingId){if(cssRules.hasOwnProperty(settingId)){SettingAPI.onChange("sidebar:"+settingId,function(to,from){generateCSS(settingId,to);updateStylesheet()})}});SettingAPI.onChange("sidebar:_tailor_page_css",function(to,from){cssCollection["_tailor_page_css"]=to;updateStylesheet()});SettingAPI.onChange("sidebar:_post_title",function(to,from){$("h1, h2, h1 a, h2 a").each(function(){if(from==this.textContent){this.textContent=to}})});window.Tailor.Settings.overrides={"*":{},tailor_button:{color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"color","tailorValidateColor"],background_color:[[".tailor-button__inner"],"background-color","tailorValidateColor"],background_color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"background-color","tailorValidateColor"],border_color:[[".tailor-button__inner"],"border-color","tailorValidateColor"],border_color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"border-color","tailorValidateColor"],padding:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],padding_tablet:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],padding_mobile:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],margin:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],margin_tablet:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],margin_mobile:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],border_width:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_radius:[[".tailor-button__inner"],"border-radius","tailorValidateUnit"],shadow:[[".tailor-button__inner"],"box-shadow"]},tailor_card:{border_color:[["",".tailor-card__header"],"border-color","tailorValidateColor"],padding:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"],padding_tablet:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"],padding_mobile:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"]},tailor_carousel:{border_color:[["",".slick-dots"],"border-color","tailorValidateColor"]},tailor_grid:{border_color:[[".tailor-grid__item"],"border-color","tailorValidateColor"],border_style:function(to,from,model){return[{selectors:["&.tailor-grid--bordered .tailor-grid__item"],declarations:{"border-style":tailorValidateString(to)+"!important"}}]},border_width:function(to,from,model){return[{selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]},border_width_tablet:function(to,from,model){return[{media:"tablet",selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]},border_width_mobile:function(to,from,model){return[{media:"mobile",selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]}},tailor_grid_item:{padding:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"],padding_tablet:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"],padding_mobile:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"]},tailor_tabs:{border_color:[[".tailor-tabs__navigation-item",".tailor-tab"],"border-color","tailorValidateColor"]},tailor_tab:{background_color:[["&.tailor-tabs__navigation-item","&.tailor-tab"],"background-color","tailorValidateColor"],padding:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],padding_tablet:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],padding_mobile:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],border_width:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],background_repeat:[["&.tailor-tab"],"background-repeat","tailorValidateString"],background_position:[["&.tailor-tab"],"background-position","tailorValidateString"],background_size:[["&.tailor-tab"],"background-size","tailorValidateString"],background_attachment:[["&.tailor-tab"],"background-attachment","tailorValidateString"]},tailor_toggle:{border_color:[[".tailor-toggle__title",".tailor-toggle__body"],"border-color","tailorValidateColor"],border_style:[[".tailor-toggle__title",".tailor-toggle__body"],"border-style","tailorValidateString"],border_radius:[[".tailor-toggle__title",".tailor-toggle__body"],"border-radius","tailorValidateUnit"]},tailor_section:{max_width:[[".tailor-section__content"],"max-width","tailorValidateUnit"],max_width_tablet:[[".tailor-section__content"],"max-width","tailorValidateUnit"],max_width_mobile:[[".tailor-section__content"],"max-width","tailorValidateUnit"],min_height:[[".tailor-section__content"],"min-height","tailorValidateUnit"],min_height_tablet:[[".tailor-section__content"],"min-height","tailorValidateUnit"],min_height_mobile:[[".tailor-section__content"],"min-height","tailorValidateUnit"]}};function getDefinition(tag,id,definition){if(window.Tailor.Settings.overrides["*"].hasOwnProperty(id)){return window.Tailor.Settings.overrides["*"][id]}if(window.Tailor.Settings.overrides.hasOwnProperty(tag)&&window.Tailor.Settings.overrides[tag].hasOwnProperty(id)){return window.Tailor.Settings.overrides[tag][id]}return definition}function registerCallbacks(definitions){_.each(definitions,function(definition,id){SettingAPI.onChange("element:"+id,function(to,from,model){definition=getDefinition(model.get("tag"),id,definition);if("function"==typeof definition){return definition.call(this,to,from,model)}if(""==to){return[]}var rule={media:getMediaQuery(id),selectors:definition[0],declarations:{}};if("function"==typeof window[definition[2]]){rule.declarations[definition[1]]=window[definition[2]](to)}else{rule.declarations[definition[1]]=to}return[rule]})})}_.each(["horizontal_alignment","horizontal_alignment_tablet","horizontal_alignment_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){var media=getMediaQuery(id);if(""!=media){media="-"+media}if(from){this.el.classList.remove("u-text-"+from+media)}this.el.classList.add("u-text-"+to+media);if("tailor_list_item"==model.get("tag")){var atts=model.get("atts");if(!_.isEmpty(atts["graphic_background_color"])||!_.isEmpty(atts["graphic_background_color_hover"])){return[{selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==to?"0":"1em","padding-right":"right"==to?"1em":"0"}}]}else{return[{selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}}]}}})});_.each(["vertical_alignment","vertical_alignment_tablet","vertical_alignment_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){var media=getMediaQuery(id);if(""!==media){media="-"+media}if(from){this.el.classList.remove("u-align-"+from+media)}this.el.classList.add("u-align-"+to+media)})});_.each(["size","size_tablet","size_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){if("tailor_button"==model.get("tag")){var media=getMediaQuery(id);if(""!=media){media="-"+media}if(from){this.el.classList.remove("tailor-button--"+from+media)}this.el.classList.add("tailor-button--"+to+media)}})});registerCallbacks({width:[[],"width","tailorValidateUnit"],width_tablet:[[],"width","tailorValidateUnit"],width_mobile:[[],"width","tailorValidateUnit"],max_width:[[],"max-width","tailorValidateUnit"],max_width_tablet:[[],"max-width","tailorValidateUnit"],max_width_mobile:[[],"max-width","tailorValidateUnit"],min_height:[[],"min-height","tailorValidateUnit"],min_height_tablet:[[],"min-height","tailorValidateUnit"],min_height_mobile:[[],"min-height","tailorValidateUnit"], -min_item_height:[[".tailor-grid__item"],"min-height","tailorValidateUnit"]});registerCallbacks({color:[[],"color","tailorValidateColor"],color_hover:[[":hover"],"color","tailorValidateColor"],link_color:[["a"],"color","tailorValidateColor"],link_color_hover:[["a:hover"],"color","tailorValidateColor"],heading_color:[["h1","h2","h3","h4","h5","h6"],"color","tailorValidateColor"],background_color:function(to,from,model){var atts=model.get("atts");if(atts["background_image"]){return false}var definition=getDefinition(model.get("tag"),"background_color",[[],"background-color","tailorValidateColor"]);if("function"==typeof definition){return definition.call(this,to,from,model)}var rule={selectors:definition[0],declarations:{}};if("function"==typeof window[definition[2]]){rule.declarations[definition[1]]=window[definition[2]](to)}else{rule.declarations[definition[1]]=to}return[rule]},background_color_hover:[[":hover"],"background-color","tailorValidateColor"],border_color:[[],"border-color","tailorValidateColor"],border_color_hover:[[":hover"],"border-color","tailorValidateColor"],graphic_color:function(to,from,model){var tag=model.get("tag");if("tailor_box"==tag){return[{selectors:[".tailor-box__graphic"],declarations:{color:tailorValidateColor(to)}}]}else if("tailor_list_item"==tag){return[{selectors:[".tailor-list__graphic"],declarations:{color:tailorValidateColor(to)}}]}},graphic_color_hover:function(to,from,model){var tag=model.get("tag");if("tailor_box"==tag){return[{selectors:[".tailor-box__graphic:hover"],declarations:{color:tailorValidateColor(to)}}]}else if("tailor_list_item"==tag){return[{selectors:[".tailor-list__graphic:hover"],declarations:{color:tailorValidateColor(to)}}]}},graphic_background_color:function(to,from,model){var tag=model.get("tag");var rules=[];if("tailor_box"==tag){if(to){rules.push({selectors:[".tailor-box__graphic"],declarations:{"margin-bottom":"1em","background-color":tailorValidateColor(to),"text-align":"center"}})}}else if("tailor_list_item"==tag){var atts=model.get("atts");var alignment=atts["horizontal_alignment"];if(to){rules.push({selectors:[".tailor-list__graphic"],declarations:{"background-color":tailorValidateColor(to),"text-align":"center"}});rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{if(!_.isEmpty(atts["graphic_background_color_hover"])){rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}})}}}return rules},graphic_background_color_hover:function(to,from,model){var tag=model.get("tag");var rules=[];if("tailor_box"==tag){if(to){rules.push({selectors:[".tailor-box__graphic"],declarations:{"margin-bottom":"1em","text-align":"center"}});rules.push({selectors:[".tailor-box__graphic:hover"],declarations:{"background-color":tailorValidateColor(to)}})}}else if("tailor_list_item"==tag){var atts=model.get("atts");var alignment=atts["horizontal_alignment"];if(to){rules.push({selectors:[".tailor-list__graphic"],declarations:{"text-align":"center"}});rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}});rules.push({selectors:[".tailor-list__graphic:hover"],declarations:{"background-color":tailorValidateColor(to)}})}else{if(!_.isEmpty(atts["graphic_background_color"])){rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}})}}}return rules},title_color:[[".tailor-toggle__title"],"color","tailorValidateColor"],title_background_color:[[".tailor-toggle__title"],"background-color","tailorValidateColor"],navigation_color:function(to,from,model){return[{selectors:[".slick-active button:before"],declarations:{"background-color":tailorValidateColor(to)}},{selectors:[".slick-arrow:not( .slick-disabled )"],declarations:{color:tailorValidateColor(to)}}]}});registerCallbacks({class:function(to,from,model){var classNames;if(!_.isEmpty(from)){classNames=from.trim().split(/\s+(?!$)/g);for(var i in classNames){if(classNames.hasOwnProperty(i)){this.el.classList.remove(classNames[i])}}}if(!_.isEmpty(to)){classNames=to.trim().split(/\s+(?!$)/g);for(var j in classNames){if(classNames.hasOwnProperty(j)){this.el.classList.add(classNames[j])}}}},border_style:[[],"border-style","tailorValidateString"],border_radius:[[],"border-radius","tailorValidateUnit"],background_repeat:[[],"background-repeat","tailorValidateString"],background_position:[[],"background-position","tailorValidateString"],background_size:[[],"background-size","tailorValidateString"],background_attachment:[[],"background-attachment","tailorValidateString"],shadow:function(to,from,model){var definition=getDefinition(model.get("tag"),"shadow",[[]]);if("function"==typeof definition){return definition.call(this,to,from,model)}if(1==to){return[{selectors:definition[0],declarations:{"box-shadow":"0 2px 6px rgba(0, 0, 0, 0.1)"}}]}return[]}});_.each({margin:[[],"margin-{0}","tailorValidateUnit"],margin_tablet:[[],"margin-{0}","tailorValidateUnit"],margin_mobile:[[],"margin-{0}","tailorValidateUnit"],padding:[[],"padding-{0}","tailorValidateUnit"],padding_tablet:[[],"padding-{0}","tailorValidateUnit"],padding_mobile:[[],"padding-{0}","tailorValidateUnit"],border_width:[[],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[[],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[[],"border-{0}-width","tailorValidateUnit"]},function(definition,id){SettingAPI.onChange("element:"+id,function(to,from,model){definition=getDefinition(model.get("tag"),id,definition);if("function"==typeof definition){return definition.call(this,to,from,model)}var rules=[];var rule={media:getMediaQuery(id),selectors:definition[0],declarations:{}};_.each(getStyleValues(to),function(value,position){if("function"==typeof window[definition[3]]){rule.declarations[definition[1].replace("{0}",position)]=window[definition[2]](value)}else{rule.declarations[definition[1].replace("{0}",position)]=value}});if(_.keys(rule.declarations).length>0){rules.push(rule)}return rules})})})})(window,window.app,window.Tailor.Api.Setting)},{}],49:[function(require,module,exports){window.tailorValidateString=function(string){return string.replace(/[0-9]/g,"")};window.tailorValidateNumber=function(string){string=string.replace(/[^0-9,.]+/i,"");return!_.isEmpty(string)?string:"0"};window.tailorValidateColor=function(color){if(/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(color)){return color}if(isRGBA(color)){return color}return""};function isRGBA(color){return/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d*(?:\.\d+)?)\)$/.test(color)}window.tailorValidateUnit=function(value){var sign="";if("-"==value.charAt(0)){sign="-";value=value.substring(1)}return sign+tailorValidateNumber(value)+getUnit(value)};function getUnit(string){var map=["px","%","in","cm","mm","pt","pc","em","rem","ex","vw","vh"];var matches=string.match(new RegExp(map.join("|")));if(matches){return matches[0]}return"px"}},{}],50:[function(require,module,exports){var $=window.jQuery,$win=$(window),app=window.app,cssModule,callbacks={sidebar:[],element:[]};function checkQuery(query){if(!query||!_.contains(_.keys(cssModule.stylesheets),query)){query="all"}return query}var onSidebarChange=function(setting){var settingId=setting.get("id");if(_.isEmpty(callbacks["sidebar"][settingId])){return}_.each(callbacks["sidebar"][settingId],function(callback){callback.apply(window,[setting.get("value"),setting.previous("value")])});$win.trigger("resize")};var onElementChange=function(setting,view){var elementId=view.model.get("id");var settingId=setting.get("id");if(!callbacks["element"].hasOwnProperty(settingId)||0==callbacks["element"][settingId].length){return}if(1==callbacks["element"][settingId].length){cssModule.deleteRules(elementId,settingId)}var ruleSets={};var rules;_.each(callbacks["element"][settingId],function(callback){if("function"==typeof callback){rules=callback.apply(view,[setting.get("value"),setting.previous("value"),view.model]);if(false===rules){view.model.trigger("change:atts",view.model,view.model.get("atts"))}else if(_.isArray(rules)&&rules.length>0){for(var rule in rules){if(rules.hasOwnProperty(rule)){if(!rules[rule].hasOwnProperty("selectors")||!rules[rule].hasOwnProperty("declarations")){continue}var query=checkQuery(rules[rule].media);ruleSets[query]=ruleSets[query]||{};ruleSets[query][elementId]=ruleSets[query][elementId]||[];if(_.keys(rules[rule].declarations).length>0){ruleSets[query][elementId].push({selectors:rules[rule].selectors,declarations:rules[rule].declarations,setting:rules[rule].setting||settingId})}}}cssModule.addRules(ruleSets)}}})};app.listenTo(app.channel,"sidebar:setting:change",onSidebarChange);app.listenTo(app.channel,"element:setting:change",onElementChange);app.channel.on("module:css:stylesheets:ready",function(module){cssModule=module});function registerCallback(type,id,callback){if("function"===typeof callback){callbacks[type][id]=callbacks[type][id]||[];callbacks[type][id].push(callback)}}module.exports={onChange:function(id,callback){var parts=id.split(":");if(parts.length>=2&&_.contains(["sidebar","element"],parts[0])){registerCallback(parts[0],parts[1],callback)}}}},{}],51:[function(require,module,exports){var DraggableBehaviors=Marionette.Behavior.extend({events:{dragstart:"onDragStart",dragend:"onDragEnd",drag:"onDrag"},onDragStart:function(e){app.channel.trigger("canvas:dragstart",e.originalEvent,this.view)},onDrag:function(e){app.channel.trigger("canvas:drag",e.originalEvent,this.view)},onDragEnd:function(e){app.channel.trigger("canvas:dragend",e.originalEvent,this.view)}});module.exports=DraggableBehaviors},{}],52:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],53:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],54:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],55:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],56:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],58:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],59:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},initialize:function(){this.$el.tabs()}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],60:[function(require,module,exports){var $=jQuery,Ajax;Ajax={url:window.ajaxurl,post:function(action,data){return ajax.send({data:_.isObject(action)?action:_.extend(data||{},{action:action})})},send:function(action,options){if(_.isObject(action)){options=action}else{options=options||{};options.data=_.extend(options.data||{},{action:action,tailor:1})}options=_.defaults(options||{},{type:"POST",url:ajax.url,context:this});return $.Deferred(function(deferred){if(options.success){deferred.done(options.success)}var onError=options.error?options.error:ajax.onError;deferred.fail(onError);delete options.success;delete options.error;$.ajax(options).done(function(response){if(response==="1"||response===1){response={success:true}}if(_.isObject(response)&&!_.isUndefined(response.success)){deferred[response.success?"resolveWith":"rejectWith"](this,[response.data])}else{deferred.rejectWith(this,[response])}}).fail(function(){deferred.rejectWith(this,arguments)})}).promise()},onError:function(response){if(!Tailor.Notify){console.error(response);return}if(response&&response.hasOwnProperty("message")){Tailor.Notify(response.message)}else if("0"==response){Tailor.Notify(window._l10n.expired)}else if("-1"==response){Tailor.Notify(window._l10n.invalid)}else{Tailor.Notify(window._l10n.error)}}};window.ajax=Ajax;module.exports=Ajax},{}],61:[function(require,module,exports){var CSS={addRule:function(sheet,selector,declaration,index){if("insertRule"in sheet){sheet.insertRule(selector+" {"+declaration+"}",sheet.cssRules.length)}else if("addRule"in sheet){sheet.addRule(selector,declaration,sheet.cssRules.length)}},deleteRule:function(sheet,index){if("deleteRule"in sheet){sheet.deleteRule(index)}else if("removeRule"in sheet){sheet.removeRule(index)}},parseSelectors:function(selectors,elementId){if(_.isString(selectors)){return selectors}var elementClass=elementId?".tailor-"+elementId:"";var prefix=".tailor-ui ";if(!selectors.length){return prefix+elementClass}selectors=selectors.map(function(selector){if(selector.indexOf("&")>-1){selector=selector.replace("&",elementClass)}else{var firstCharacter=selector.charAt(0);if(":"==firstCharacter||"::"==firstCharacter){selector=elementClass+selector}else{ -selector=elementClass+" "+selector}}return prefix+selector});return selectors.join(",")},parseDeclarations:function(declarations){if(_.isString(declarations)){return declarations}var declaration="";_.each(declarations,function(value,property){declaration+=property+":"+value+";"});return declaration}};module.exports=CSS},{}],62:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;i0){rules.push(rule)}return rules})})})})(window,window.app,window.Tailor.Api.Setting)},{}],49:[function(require,module,exports){window.tailorValidateString=function(string){return string.replace(/[0-9]/g,"")};window.tailorValidateNumber=function(string){string=string.replace(/[^0-9,.]+/i,"");return!_.isEmpty(string)?string:"0"};window.tailorValidateColor=function(color){if(/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(color)){return color}if(isRGBA(color)){return color}return""};function isRGBA(color){return/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d*(?:\.\d+)?)\)$/.test(color)}window.tailorValidateUnit=function(value){var sign="";if("-"==value.charAt(0)){sign="-";value=value.substring(1)}return sign+tailorValidateNumber(value)+getUnit(value)};function getUnit(string){var map=["px","%","in","cm","mm","pt","pc","em","rem","ex","vw","vh"];var matches=string.match(new RegExp(map.join("|")));if(matches){return matches[0]}return"px"}},{}],50:[function(require,module,exports){var $=window.jQuery,$win=$(window),app=window.app,cssModule,callbacks={sidebar:[],element:[]};function checkQuery(query){if(!query||!_.contains(_.keys(cssModule.stylesheets),query)){query="all"}return query}var onSidebarChange=function(setting){var settingId=setting.get("id");if(_.isEmpty(callbacks["sidebar"][settingId])){return}_.each(callbacks["sidebar"][settingId],function(callback){callback.apply(window,[setting.get("value"),setting.previous("value")])});$win.trigger("resize")};var onElementChange=function(setting,view){var elementId=view.model.get("id");var settingId=setting.get("id");if(!callbacks["element"].hasOwnProperty(settingId)||0==callbacks["element"][settingId].length){return}if(1==callbacks["element"][settingId].length){cssModule.deleteRules(elementId,settingId)}var ruleSets={};var rules;_.each(callbacks["element"][settingId],function(callback){if("function"==typeof callback){rules=callback.apply(view,[setting.get("value"),setting.previous("value"),view.model]);if(false===rules){view.model.trigger("change:atts",view.model,view.model.get("atts"))}else if(_.isArray(rules)&&rules.length>0){for(var rule in rules){if(rules.hasOwnProperty(rule)){if(!rules[rule].hasOwnProperty("selectors")||!rules[rule].hasOwnProperty("declarations")){continue}var query=checkQuery(rules[rule].media);ruleSets[query]=ruleSets[query]||{};ruleSets[query][elementId]=ruleSets[query][elementId]||[];if(_.keys(rules[rule].declarations).length>0){ruleSets[query][elementId].push({selectors:rules[rule].selectors,declarations:rules[rule].declarations,setting:rules[rule].setting||settingId})}}}cssModule.addRules(ruleSets)}}})};app.listenTo(app.channel,"sidebar:setting:change",onSidebarChange);app.listenTo(app.channel,"element:setting:change",onElementChange);app.channel.on("module:css:stylesheets:ready",function(module){cssModule=module});function registerCallback(type,id,callback){if("function"===typeof callback){callbacks[type][id]=callbacks[type][id]||[];callbacks[type][id].push(callback)}}module.exports={onChange:function(id,callback){var parts=id.split(":");if(parts.length>=2&&_.contains(["sidebar","element"],parts[0])){registerCallback(parts[0],parts[1],callback)}}}},{}],51:[function(require,module,exports){var DraggableBehaviors=Marionette.Behavior.extend({events:{dragstart:"onDragStart",dragend:"onDragEnd",drag:"onDrag"},onDragStart:function(e){app.channel.trigger("canvas:dragstart",e.originalEvent,this.view)},onDrag:function(e){app.channel.trigger("canvas:drag",e.originalEvent,this.view)},onDragEnd:function(e){app.channel.trigger("canvas:dragend",e.originalEvent,this.view)}});module.exports=DraggableBehaviors},{}],52:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],53:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],54:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],55:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],56:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],58:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],59:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},initialize:function(){this.$el.accordion()}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],60:[function(require,module,exports){var $=jQuery,Ajax;Ajax={url:window.ajaxurl,post:function(action,data){return ajax.send({data:_.isObject(action)?action:_.extend(data||{},{action:action})})},send:function(action,options){if(_.isObject(action)){options=action}else{options=options||{};options.data=_.extend(options.data||{},{action:action,tailor:1})}options=_.defaults(options||{},{type:"POST",url:ajax.url,context:this});return $.Deferred(function(deferred){if(options.success){deferred.done(options.success)}var onError=options.error?options.error:ajax.onError;deferred.fail(onError);delete options.success;delete options.error;$.ajax(options).done(function(response){if(response==="1"||response===1){response={success:true}}if(_.isObject(response)&&!_.isUndefined(response.success)){deferred[response.success?"resolveWith":"rejectWith"](this,[response.data])}else{deferred.rejectWith(this,[response])}}).fail(function(){deferred.rejectWith(this,arguments)})}).promise()},onError:function(response){if(!Tailor.Notify){console.error(response);return}if(response&&response.hasOwnProperty("message")){Tailor.Notify(response.message)}else if("0"==response){Tailor.Notify(window._l10n.expired)}else if("-1"==response){Tailor.Notify(window._l10n.invalid)}else{Tailor.Notify(window._l10n.error)}}};window.ajax=Ajax;module.exports=Ajax},{}],61:[function(require,module,exports){var CSS={addRule:function(sheet,selector,declaration,index){if("insertRule"in sheet){sheet.insertRule(selector+" {"+declaration+"}",sheet.cssRules.length)}else if("addRule"in sheet){sheet.addRule(selector,declaration,sheet.cssRules.length)}},deleteRule:function(sheet,index){if("deleteRule"in sheet){sheet.deleteRule(index)}else if("removeRule"in sheet){sheet.removeRule(index)}},parseSelectors:function(selectors,elementId){if(_.isString(selectors)){return selectors}var elementClass=elementId?".tailor-"+elementId:"";var prefix=".tailor-ui ";if(!selectors.length){return prefix+elementClass}selectors=selectors.map(function(selector){if(selector.indexOf("&")>-1){selector=selector.replace("&",elementClass)}else{var firstCharacter=selector.charAt(0);if(":"==firstCharacter||"::"==firstCharacter){selector=elementClass+selector; +}else{selector=elementClass+" "+selector}}return prefix+selector});return selectors.join(",")},parseDeclarations:function(declarations){if(_.isString(declarations)){return declarations}var declaration="";_.each(declarations,function(value,property){declaration+=property+":"+value+";"});return declaration}};module.exports=CSS},{}],62:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;i'};options.dots=true}$el.tailorSlideshow(options)});$(".is-lightbox-gallery").each(function(){var $el=$(this);if($el.hasClass("tailor-carousel")){$el.tailorLightbox({delegate:".slick-slide:not( .slick-cloned ) .is-lightbox-image"})}else{$el.tailorLightbox()}});$(".is-lightbox-image").tailorLightbox({delegate:false})}};window.Tailor.Components.Abstract=abstractComponent;window.Tailor.Components.Lightbox=require("./shared/components/ui/lightbox");window.Tailor.Components.Map=require("./shared/components/ui/map");window.Tailor.Components.Masonry=require("./shared/components/ui/masonry");window.Tailor.Components.Parallax=require("./shared/components/ui/parallax");window.Tailor.Components.Slideshow=require("./shared/components/ui/slideshow");window.Tailor.Components.Tabs=require("./shared/components/ui/tabs");window.Tailor.Components.Toggles=require("./shared/components/ui/toggles");require("./frontend/components/ui/carousel");$(document).ready(function(){window.Tailor.initElements()})},{"./frontend/components/ui/carousel":2,"./shared/components/ui/abstract":3,"./shared/components/ui/lightbox":4,"./shared/components/ui/map":5,"./shared/components/ui/masonry":6,"./shared/components/ui/parallax":7,"./shared/components/ui/slideshow":8,"./shared/components/ui/tabs":9,"./shared/components/ui/toggles":10,"./shared/utility/polyfills/classlist":11,"./shared/utility/polyfills/raf":12,"./shared/utility/polyfills/transitions":13}],2:[function(require,module,exports){var $=window.jQuery,Carousel;Carousel=function(el,options,callbacks){this.el=el;this.$el=$(el);this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.options=$.extend(this.defaults,options,this.$el.data());if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.callbacks=$.extend(this.callbacks,callbacks);this.initialize()};Carousel.prototype={defaults:{items:"> .tailor-carousel__item",speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:false,adaptiveHeight:true,draggable:true,infinite:false,prevArrow:'',nextArrow:''},callbacks:{onInitialize:function(){},onDestroy:function(){}},initialize:function(){this.$items=this.$wrap.find(this.options.items);this.slick();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},slick:function(){this.$wrap.slick(this.options)},unSlick:function(){this.$wrap.slick("unslick")},destroy:function(e){this.unSlick();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}}};$.fn.tailorCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorCarousel");if(!instance){$.data(this,"tailorCarousel",new Carousel(this,options,callbacks))}})}},{}],3:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],4:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],5:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],6:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],7:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],9:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],10:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},initialize:function(){this.$el.tabs()}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],11:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;i'};options.dots=true}$el.tailorSlideshow(options)});$(".is-lightbox-gallery").each(function(){var $el=$(this);if($el.hasClass("tailor-carousel")){$el.tailorLightbox({delegate:".slick-slide:not( .slick-cloned ) .is-lightbox-image"})}else{$el.tailorLightbox()}});$(".is-lightbox-image").tailorLightbox({delegate:false})}};window.Tailor.Components.Abstract=abstractComponent;window.Tailor.Components.Lightbox=require("./shared/components/ui/lightbox");window.Tailor.Components.Map=require("./shared/components/ui/map");window.Tailor.Components.Masonry=require("./shared/components/ui/masonry");window.Tailor.Components.Parallax=require("./shared/components/ui/parallax");window.Tailor.Components.Slideshow=require("./shared/components/ui/slideshow");window.Tailor.Components.Tabs=require("./shared/components/ui/tabs");window.Tailor.Components.Toggles=require("./shared/components/ui/toggles");require("./frontend/components/ui/carousel");$(document).ready(function(){window.Tailor.initElements()})},{"./frontend/components/ui/carousel":2,"./shared/components/ui/abstract":3,"./shared/components/ui/lightbox":4,"./shared/components/ui/map":5,"./shared/components/ui/masonry":6,"./shared/components/ui/parallax":7,"./shared/components/ui/slideshow":8,"./shared/components/ui/tabs":9,"./shared/components/ui/toggles":10,"./shared/utility/polyfills/classlist":11,"./shared/utility/polyfills/raf":12,"./shared/utility/polyfills/transitions":13}],2:[function(require,module,exports){var $=window.jQuery,Carousel;Carousel=function(el,options,callbacks){this.el=el;this.$el=$(el);this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.options=$.extend(this.defaults,options,this.$el.data());if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.callbacks=$.extend(this.callbacks,callbacks);this.initialize()};Carousel.prototype={defaults:{items:"> .tailor-carousel__item",speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:false,adaptiveHeight:true,draggable:true,infinite:false,prevArrow:'',nextArrow:''},callbacks:{onInitialize:function(){},onDestroy:function(){}},initialize:function(){this.$items=this.$wrap.find(this.options.items);this.slick();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},slick:function(){this.$wrap.slick(this.options)},unSlick:function(){this.$wrap.slick("unslick")},destroy:function(e){this.unSlick();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}}};$.fn.tailorCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorCarousel");if(!instance){$.data(this,"tailorCarousel",new Carousel(this,options,callbacks))}})}},{}],3:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],4:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],5:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],6:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],7:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],9:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],10:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},initialize:function(){this.$el.accordion()}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],11:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;i Date: Fri, 10 Mar 2017 14:24:43 -0600 Subject: [PATCH 4/8] Successfully hooked up toggles jQuery UI for toggles We just needed to define the header option for the toggles --- assets/js/dist/canvas.js | 4 +++- assets/js/dist/canvas.min.js | 2 +- assets/js/dist/frontend.js | 4 +++- assets/js/dist/frontend.min.js | 2 +- assets/js/src/shared/components/ui/toggles.js | 4 +++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/assets/js/dist/canvas.js b/assets/js/dist/canvas.js index 29df0ae..5c4ba5f 100644 --- a/assets/js/dist/canvas.js +++ b/assets/js/dist/canvas.js @@ -9418,7 +9418,9 @@ Toggles = Components.create( { }, initialize : function() { - this.$el.accordion(); + this.$el.accordion({ + header : '.tailor-toggle h3' + }); } // /** diff --git a/assets/js/dist/canvas.min.js b/assets/js/dist/canvas.min.js index f48d5c6..b01575d 100644 --- a/assets/js/dist/canvas.min.js +++ b/assets/js/dist/canvas.min.js @@ -1,5 +1,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o'+'
    '+"
    ")},onResize:function(e){var columnView=this;var device=app.channel.request("sidebar:device");var setting="desktop"==device?"width":"width_"+device;var model=columnView.model;var nextModel=model.collection.findWhere({parent:model.get("parent"),order:model.get("order")+1});var atts=model.get("atts");var nextAtts=nextModel.get("atts");var width=parseFloat(atts[setting]||atts.width);var nextWidth=parseFloat(nextAtts[setting]||nextAtts.width);var columnsWidth=width+nextWidth;var column=columnView.el.getBoundingClientRect();var $first=$(''+width+"%");var $second=$(''+nextWidth+"%");$first.prependTo(columnView.$el);$second.prependTo(columnView.$el.next());function onResize(e){document.body.classList.add("is-resizing");document.body.style.cursor="col-resize";var columnWidth=Math.min(columnsWidth-10,Math.max(10,Math.round(parseFloat((e.clientX-column.left)/column.width*width)*10)/10));var nextColumnWidth=Math.round(parseFloat(columnsWidth-columnWidth)*10)/10;columnWidth+="%";nextColumnWidth+="%";$first.html(columnWidth);$second.html(nextColumnWidth);var atts=_.clone(model.get("atts"));var nextAtts=_.clone(nextModel.get("atts"));atts[setting]=columnWidth;nextAtts[setting]=nextColumnWidth;model.set("atts",atts,{silent:true});nextModel.set("atts",nextAtts,{silent:true});model.trigger("change:width",model,atts);nextModel.trigger("change:width",nextModel,nextAtts)}function onResizeEnd(){document.removeEventListener("mousemove",onResize,false);document.removeEventListener("mouseup",onResizeEnd,false);document.body.classList.remove("is-resizing");document.body.style.cursor="default";$first.remove();$second.remove();var atts=model.get("atts");if(width!=atts[setting]){app.channel.trigger("element:resize",model)}}document.addEventListener("mousemove",onResize,false);document.addEventListener("mouseup",onResizeEnd,false);app.channel.trigger("canvas:reset");return false},onChangeWidth:function(model,atts){this.updateCSS(model.get("id"),atts);this.triggerAll("element:refresh",this)},updateCSS:function(elementId,atts){var ruleSet={};var width=atts["width"];var tabletWidth=atts["width_tablet"]||atts["width"];var mobileWidth=atts["width_mobile"]||atts["width"];ruleSet["desktop"]={};ruleSet["desktop"][elementId]=[{selectors:[],declarations:{width:width},setting:"width"}];ruleSet["tablet"]={};ruleSet["tablet"][elementId]=[{selectors:[".mobile-columns &",".tablet-columns &"],declarations:{width:tabletWidth},setting:"width_tablet"}];ruleSet["mobile"]={};ruleSet["mobile"][elementId]=[{selectors:[".mobile-columns &"],declarations:{width:mobileWidth},setting:"width_mobile"}];cssModule.deleteRules(elementId,"width");cssModule.deleteRules(elementId,"width_tablet");cssModule.deleteRules(elementId,"width_mobile");cssModule.addRules(ruleSet)}});module.exports=ColumnView},{"./../element-container":17}],10:[function(require,module,exports){var ContainerView=require("./../element-container"),TabView;TabView=ContainerView.extend({onRenderTemplate:function(){this.el.draggable=false;this.el.id=this.model.cid}});module.exports=TabView},{"./../element-container":17}],11:[function(require,module,exports){var ContainerView=require("./../element-container"),CarouselNavigationView=require("./navigation/carousel-navigation"),CarouselView;CarouselView=ContainerView.extend({onBeforeRenderTemplate:function(){if(this.navigation){this.navigation.triggerMethod("destroy")}},onRenderTemplate:function(){this.navigation=new CarouselNavigationView({model:this.model,collection:this.collection,sort:false});this.$el.append(this.navigation.render().el)},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this);this.navigation.triggerMethod("destroy")}});module.exports=CarouselView},{"./../element-container":17,"./navigation/carousel-navigation":13}],12:[function(require,module,exports){module.exports=Marionette.ItemView.extend({tagName:"li",attributes:function(){return{"data-id":this.model.cid}},getTemplate:function(){return _.template('')}})},{}],13:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({tagName:"ul",className:"slick-dots",childView:require("./carousel-navigation-item"),events:{dragstart:"onDragStart"},onDragStart:function(e){app.channel.trigger("canvas:reset");e.stopPropagation()},onRender:function(){var view=this;this.sortable=new Sortable(view.el,{draggable:"li",animation:150,onUpdate:function(e){var cid=e.item.getAttribute("data-id");view.$el.trigger("before:navigation:reorder",[cid,e.newIndex,e.oldIndex]);view.$el.trigger("navigation:reorder",[cid,e.newIndex,e.oldIndex]);app.channel.trigger("navigation:reorder",view.model)}})},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return child.get("parent")===this.model.get("id")},onBeforeDestroy:function(){this.sortable.destroy()}})},{"./carousel-navigation-item":12}],14:[function(require,module,exports){module.exports=Marionette.ItemView.extend({tagName:"li",className:function(){return"tailor-tabs__navigation-item tailor-"+this.model.get("id")},modelEvents:{"change:atts":"onChangeAttributes"},attributes:function(){return{"data-id":this.model.cid}},getTemplate:function(){return _.template('<%= title || "Tab" %>')},serializeData:function(){var data=Marionette.ItemView.prototype.serializeData.apply(this,arguments);var atts=this.model.get("atts");data.title=atts.title;return data},onChangeAttributes:function(model,atts){this.el.innerHTML=atts.title||"Tab"}})},{}],15:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({childView:require("./tabs-navigation-item"),events:{dragstart:"onDragStart"},onDragStart:function(e){app.channel.trigger("canvas:reset");e.stopPropagation()},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return child.get("parent")===this.model.get("id")},onRender:function(){var view=this;this.sortable=new Sortable(view.el,{draggable:"li",animation:150,onUpdate:function(e){var cid=e.item.getAttribute("data-id");view.$el.trigger("before:navigation:reorder",[cid,e.newIndex,e.oldIndex]);view.$el.trigger("navigation:reorder",[cid,e.newIndex,e.oldIndex]);app.channel.trigger("navigation:reorder",view.model)}})},onBeforeDestroy:function(){this.sortable.destroy()}})},{"./tabs-navigation-item":14}],16:[function(require,module,exports){var ContainerView=require("./../element-container"),TabsNavigationView=require("./navigation/tabs-navigation"),TabsView;TabsView=ContainerView.extend({ui:{navigation:".tailor-tabs__navigation"},onBeforeRenderTemplate:function(){if(this.navigation){this.navigation.triggerMethod("destroy")}},onRenderTemplate:function(){this.navigation=new TabsNavigationView({el:this.ui.navigation,model:this.model,collection:this.collection,sort:false});this.navigation.render()},childRefreshed:function(childView){childView.el.id=childView.model.cid;childView.el.classList.add("is-active");this.triggerAll("element:child:refresh",childView)},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this);this.navigation.triggerMethod("destroy")}});module.exports=TabsView},{"./../element-container":17,"./navigation/tabs-navigation":15}],17:[function(require,module,exports){var CompositeView=Marionette.CompositeView.extend({behaviors:{Container:{},Draggable:{},Droppable:{},Editable:{},Movable:{}},modelEvents:{"change:atts":"onChangeAttributes","change:order":"onChangeOrder","change:parent":"onChangeParent","change:setting":"onChangeSetting"},childEvents:{"before:element:ready":"beforeChildElementReady","element:ready":"childElementReady","before:element:refresh":"beforeChildElementRefreshed","element:refresh":"childElementRefreshed","before:element:jsRefresh":"beforeChildElementJSRefreshed","element:jsRefresh":"childElementJSRefreshed","element:change:parent":"childElementChangeParent","element:change:order":"childElementChangeOrder","before:element:destroy":"beforeChildElementDestroyed","element:destroy":"childElementDestroyed"},events:{"before:element:ready":"stopEventPropagation","element:ready":"stopEventPropagation","before:element:refresh":"stopEventPropagation","element:refresh":"stopEventPropagation","before:element:copy":"stopEventPropagation","element:copy":"stopEventPropagation","element:child:change:parent":"onDescendantChangeParent","element:child:change:order":"onDescendantChangeOrder","before:element:destroy":"stopEventPropagation","element:destroy":"stopEventPropagation","element:child:add":"onDescendantAdded","element:child:remove":"onDescendantRemoved","before:element:child:ready":"onBeforeDescendantReady","element:child:ready":"onDescendantReady","before:element:child:refresh":"onBeforeDescendantRefreshed","element:child:refresh":"onDescendantRefreshed","before:element:child:jsRefresh":"onBeforeDescendantJSRefreshed","element:child:jsRefresh":"onDescendantJSRefreshed","before:element:child:destroy":"onBeforeDescendantDestroyed","element:child:destroy":"onDescendantDestroyed","before:navigation:reorder":"stopEventPropagation","navigation:reorder":"onReorder"},onReorder:function(e,cid,index,oldIndex){var view=this.children.findByModelCid(cid);var otherView=this.children.find(function(childView){return childView.model.get("order")==index});if(oldIndex-index<0){view.$el.insertAfter(otherView.$el)}else{view.$el.insertBefore(otherView.$el)}this.children.each(function(childView){var childIndex=childView.$el.index();childView._index=childIndex;childView.model.set("order",childIndex)});view.model.collection.sort();e.stopPropagation()},onChangeAttributes:_.debounce(function(model,atts){model=this.model.toJSON();model.atts=atts?atts:{};var view=this;view.el.classList.add("is-rendering");window.ajax.send("tailor_render",{data:{model:JSON.stringify(model),nonce:window._nonces.render},success:function(response){view.updateTemplate(response.html);var id=view.model.get("id");app.channel.trigger("css:update",id,response.css)},error:function(response){view.updateTemplate('

    The template for '+view.cid+" could not be refreshed

    ");console.log(response)},complete:function(){var isEditing=view.$el.hasClass("is-editing");var isSelected=view.$el.hasClass("is-selected");view.$el.removeClass("is-rendering");view.triggerAll("before:element:refresh",view,model.atts);view.renderTemplate();view.triggerAll("element:refresh",view,model.atts);if(isEditing){view.$el.addClass("is-editing")}if(isSelected){view.$el.addClass("is-selected")}}})},250),onChangeOrder:function(){this.triggerAll("element:change:order",this)},onChangeParent:function(){this.triggerAll("element:change:parent",this)},onChangeSetting:function(setting,refresh){if(refresh){this.triggerAll("before:element:jsRefresh",this,this.model.get("atts"));app.channel.trigger("element:setting:change",setting,this);this.triggerAll("element:jsRefresh",this,this.model.get("atts"))}},initialize:function(){this._isReady=false;this._isBeingDestroyed=false;this.options.childViewContainer=this.model.get("child_container")||null;this.addEventListeners()},addEventListeners:function(){this.listenTo(app.channel,"before:elements:restore",this.onBeforeDestroy)},getChildView:function(child){return Tailor.lookup(child.get("tag"),child.get("type"),"Views")},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return child.get("parent")===this.model.get("id")},attachElContent:function(html){var $el=jQuery(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("draggable",true);this.el.setAttribute("tailor-label",this.model.get("label"));this.el.classList.add("tailor-"+this.model.cid);this.el.title=_l10n.edit_element;return this},getTemplateId:function(){return"tmpl-tailor-"+this.model.get("id")},getTemplate:function(){var el=document.querySelector("#"+this.getTemplateId());var template;if(el){template=_.template(el.innerHTML);el.parentElement.removeChild(el)}else{el=document.querySelector("#tmpl-tailor-"+this.model.get("tag")+"-default");template=_.template(el.innerHTML)}return template},updateTemplate:function(html){var templateId=this.getTemplateId();var el=document.querySelector("#"+templateId);if(!el){el=document.createElement("script");el.setAttribute("type","text/html");el.id=templateId;document.body.appendChild(el)}el.innerHTML=html},renderTemplate:function(){this._ensureViewIsIntact();var $childViewContainer=this.getChildViewContainer(this);var $children=$childViewContainer.contents().detach();this.resetChildViewContainer();this._renderTemplate();$childViewContainer=this.getChildViewContainer(this);$childViewContainer.append($children);return this},onBeforeRender:function(){this.triggerAll("before:element:ready",this)},onDomRefresh:function(){this.$el.find("a").attr({draggable:false,target:"_blank"});this.$el.find("img").attr({draggable:false})},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this)},onDestroy:function(){this.triggerAll("element:destroy",this)},beforeChildElementReady:function(childView){if(this._isReady&&this.children.contains(childView)){this.triggerAll("before:element:child:ready",childView)}},childElementReady:function(childView){if(this.children.contains(childView)){if(!this._isReady){var readyChildren=this.children.filter(function(childView){return childView._isReady}).length;if(this.children.length==readyChildren){this._isReady=true;this.triggerAll("element:ready",this)}}else{this.triggerAll("element:child:ready",childView)}}},beforeChildElementRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("before:element:child:refresh",childView)}},childElementRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:refresh",childView)}},beforeChildElementJSRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("before:element:child:jsRefresh",childView)}},childElementJSRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:jsRefresh",childView)}},childElementChangeOrder:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:change:order",childView)}},childElementChangeParent:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:change:parent",childView)}},beforeChildElementDestroyed:function(childView){if(!this._isBeingDestroyed){this.triggerAll("before:element:child:destroy",childView)}},childElementDestroyed:function(childView){if(!this._isBeingDestroyed){this.triggerAll("element:child:destroy",childView)}},onDescendantAdded:function(e,view){this.triggerAll("element:descendant:add",view);e.stopPropagation()},onDescendantRemoved:function(e,view){this.triggerAll("element:descendant:remove",view);e.stopPropagation()},onBeforeDescendantReady:function(e,view){this.triggerAll("before:element:descendant:ready",view);e.stopPropagation()},onDescendantReady:function(e,view){this.triggerAll("element:descendant:ready",view);e.stopPropagation()},onBeforeDescendantRefreshed:function(e,view){this.triggerAll("before:element:descendant:refresh",view);e.stopPropagation()},onDescendantRefreshed:function(e,view){this.triggerAll("element:descendant:refresh",view);e.stopPropagation()},onBeforeDescendantJSRefreshed:function(e,view){this.triggerAll("before:element:descendant:jsRefresh",view);e.stopPropagation()},onDescendantJSRefreshed:function(e,view){this.triggerAll("element:descendant:jsRefresh",view);e.stopPropagation()},onDescendantChangeOrder:function(e,view){this.triggerAll("element:descendant:change:order",view);e.stopPropagation()},onDescendantChangeParent:function(e,view){this.triggerAll("element:descendant:change:parent",view);e.stopPropagation()},onBeforeDescendantDestroyed:function(e,view){this.triggerAll("before:element:descendant:destroy",view);e.stopPropagation()},onDescendantDestroyed:function(e,view){this.triggerAll("element:descendant:destroy",view);e.stopPropagation()},stopEventPropagation:function(e){e.stopPropagation()},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}},_updateIndices:function(view,increment,index){if(increment){view._index=index;view.model._changing=false;view.model.set("order",index)}this.children.each(function(laterView){if(laterView._index>=view._index){laterView._index+=increment?1:-1; laterView.model.set("order",laterView._index)}},this)}});module.exports=CompositeView},{}],18:[function(require,module,exports){var $=window.jQuery,ElementView;ElementView=Marionette.ItemView.extend({className:"element",attributes:{draggable:true},behaviors:{Draggable:{},Droppable:{},Editable:{},Movable:{}},modelEvents:{"change:atts":"onChangeAttributes","change:parent":"onChangeParent","change:setting":"onChangeSetting"},initialize:function(){this._isReady=false;this._isBeingDestroyed=false;this.addEventListeners()},addEventListeners:function(){this.listenTo(app.channel,"before:elements:restore",this.onBeforeDestroy)},getTemplateId:function(){return"tmpl-tailor-"+this.model.get("id")},getTemplate:function(){var el=document.querySelector("#"+this.getTemplateId());var template;if(el){template=_.template(el.innerHTML);el.parentElement.removeChild(el)}else{el=document.querySelector("#tmpl-tailor-"+this.model.get("tag")+"-default");template=_.template(el.innerHTML)}return template},attachElContent:function(html){var $el=$(html);var el=$el[0];this.$el.replaceWith(el);this.setElement(el);this.el.setAttribute("draggable",true);this.el.setAttribute("tailor-label",this.model.get("label"));this.el.classList.add("tailor-"+this.model.id);this.el.title=_l10n.edit_element;return this},updateTemplate:function(html){var templateId=this.getTemplateId();var el=document.querySelector("#"+templateId);if(!el){el=document.createElement("script");el.setAttribute("type","text/html");el.id=templateId;document.body.appendChild(el)}el.innerHTML=html},onChangeAttributes:_.debounce(function(model,atts){var view=this;model=model.toJSON();if(atts){model.atts=atts}view.el.classList.add("is-rendering");window.ajax.send("tailor_render",{data:{model:JSON.stringify(model),nonce:window._nonces.render},success:function(response){view.updateTemplate(response.html);app.channel.trigger("css:update",view.model.get("id"),response.css)},error:function(response){view.updateTemplate('

    The template for '+view.cid+" could not be refreshed

    ");console.log(response)},complete:function(){var isEditing=view.$el.hasClass("is-editing");var isSelected=view.$el.hasClass("is-selected");view.$el.removeClass("is-rendering");view.triggerAll("before:element:refresh",view,model.atts);view.render();view.triggerAll("element:refresh",view,model.atts);if(isEditing){view.$el.addClass("is-editing")}if(isSelected){view.$el.addClass("is-selected")}}})},500),onChangeSetting:function(setting,refresh){if(refresh){this.triggerAll("before:element:jsRefresh",this,this.model.get("atts"));app.channel.trigger("element:setting:change",setting,this);this.triggerAll("element:jsRefresh",this,this.model.get("atts"))}},onChangeParent:function(){this.triggerAll("element:change:parent",this)},onBeforeRender:function(){this.triggerAll("before:element:ready",this)},onDomRefresh:function(){var view=this;this.$el.find("a").attr({draggable:false,target:"_blank"});this.$el.find("[onchange]").removeAttr("onchange");this.$el.find("img").attr({draggable:false});this.$el.imagesLoaded(function(){view._isReady=true;if(view.el.classList.contains("tailor-widget")&&0==view.$el.children().innerHeight()){var el=document.querySelector("#tmpl-tailor-element-empty");if(el){view.$el.html(el.innerHTML)}}view.triggerAll("element:ready",view)})},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this)},onDestroy:function(){this.triggerAll("element:destroy",this)},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}}});module.exports=ElementView},{}],19:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Carousel;Carousel=Components.create({slickActive:false,getDefaults:function(){return{items:".tailor-carousel__item",prevArrow:'',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:true,fade:false}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.slick()},slick:function(){var component=this;component.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){this.$wrap.slick("refresh")},unSlick:function(){this.$wrap.slick("unslick")},onMove:function(){if(this.slickActive){this.refreshSlick()}},onBeforeCopy:function(){if(this.slickActive){this.unSlick()}},onCopy:function(){if(!this.slickActive){this.slick()}},onBeforeRefresh:function(){if(this.slickActive){this.unSlick()}},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){if(this.slickActive){this.unSlick()}},onResize:function(){if(this.slickActive){this.refreshSlick()}}});$.fn.tailorSimpleCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSimpleCarousel");if(!instance){$.data(this,"tailorSimpleCarousel",new Carousel(this,options,callbacks))}})}},{}],20:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Carousel;Carousel=Components.create({getDefaults:function(){return{items:".tailor-carousel__item",prevArrow:'',nextArrow:'',adaptiveHeight:false,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,initialSlide:0,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:false,infinite:false}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.slickAt(0,this.addEventListeners)},slickAt:function(index,callback){this.querySelectors();var numberItems=this.$items.length;if(!numberItems){return}index=Math.min(index,numberItems-1);if(index "+component.options.items);component.$dots=component.$el.children(".slick-dots").find(" > li");component.$dots.on("click",function(e){var $dot=$(e.currentTarget);component.currentSlide=$dot.data("id");component.$wrap.slick("slickGoTo",$dot.index());e.preventDefault()});if(!component.currentSlide){var $activeSlide=component.$items.filter(function(){return this.classList.contains("slick-current")});component.currentSlide=$activeSlide.length?$activeSlide.id:component.$items[0].id}},updateDots:function(index){this.$dots.each(function(i,el){if(index==i){el.classList.add("slick-active")}else{el.classList.remove("slick-active")}});this.$dots.toggle(this.$dots.length/this.options.slidesToShow>1)},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onBeforeRefresh:function(){this.unSlick()},onRefresh:function(){this.refreshSlick()},onJSRefresh:function(){this.refreshSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onAddChild:function(){this.refreshSlick()},onRemoveChild:function(e,childView){childView.$el.detach();this.refreshSlick()},onBeforeReadyChild:function(e,childView){this.unSlick()},onReadyChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeReorderChild:function(){this.unSlick()},onReorderChild:function(e,cid,index,oldIndex){this.querySelectors();this.slickAt(index)},onBeforeRefreshChild:function(){this.unSlick()},onRefreshChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeJSRefreshChild:function(){this.unSlick()},onJSRefreshChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeDestroyChild:function(){this.unSlick()},onDestroyChild:function(e,childView){var index=childView.$el.index();childView.$el.remove();this.slickAt(index)},onAddDescendant:function(){this.refreshSlick()},onRemoveDescendant:function(){this.refreshSlick()},onReadyDescendant:function(){this.refreshSlick()},onRefreshDescendant:function(){this.refreshSlick()},onJSRefreshDescendant:function(){this.refreshSlick()},onDestroyDescendant:function(){this.refreshSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorCarousel");if(!instance){$.data(this,"tailorCarousel",new Carousel(this,options,callbacks))}})}},{}],21:[function(require,module,exports){var ElementCollection=Backbone.Collection.extend({comparator:"order",model:function(attrs,options){var Model=Tailor.lookup(attrs.tag,attrs.type,"Models");return new Model(attrs,options)},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"change:parent",this.onChangeParent);this.listenTo(this,"add",this.onAdd);this.listenTo(this,"destroy",this.onDestroy);this.listenTo(this,"container:collapse",this.onCollapse);this.listenTo(this,"reset",this.onReset)},getElementDefinitions:function(){return this.library||app.channel.request("sidebar:library")},applyDefaults:function(model){if(model instanceof Backbone.Model){model=model.toJSON()}var item=this.getElementDefinitions().findWhere({tag:model.tag});var defaults={label:item.get("label"),type:item.get("type")};var child=item.get("child");if(child){defaults.child=child}var childViewContainer=item.get("child_container");if(childViewContainer){defaults.child_container=childViewContainer}model.atts=model.atts||{};_.each(item.get("settings"),function(setting){if(!_.isEmpty(setting["value"])&&!model.atts.hasOwnProperty(setting["id"])){model.atts[setting["id"]]=setting["value"]}});return _.extend(model,defaults)},getParent:function(model){return this.findWhere({id:model.get("parent")})},getChildren:function(model){return this.where({parent:model.get("id")})},getSiblings:function(model){return this.where({parent:model.get("parent")})},hasSelectedParent:function(model){var selected=app.channel.request("canvas:element:selected");if(!selected||model===selected){return false}var parentId=model.get("parent");var parent=this.findWhere({id:parentId});while("undefined"!==typeof parent){if(selected===parent){return true}parentId=parent.get("parent");parent=this.get(parentId)}return false},onChangeParent:function(model){var parent=this.get(model.get("parent"));var previousParent=this.get(model.previous("parent"));this.sort({silent:true});this._checkParent(previousParent);if("tailor_column"===model.get("tag")){this._reBalanceColumns(parent);this._reBalanceColumns(previousParent)}},onAdd:function(model,collection,options){if("tailor_column"==model.get("tag")){this._reBalanceColumns(this.get(model.get("parent")))}},onDestroy:function(model){var parent=this.get(model.get("parent"));this._checkParent(parent);var children=this.where({parent:model.get("id")});if(children.length){_.each(children,function(child){child.trigger("destroy",child,this)},this)}if(parent&&"tailor_column"===model.get("tag")){this._reBalanceColumns(parent)}if(0===this.length){this.onEmpty()}},onReset:function(){if(0===this.length){this.onEmpty()}},onEmpty:function(){var section=this.createSection(0);this.create([{tag:"tailor_content",atts:{},parent:section.get("id"),order:0}])},onCollapse:function(model,children){var parentId=model.get("parent");_.each(children,function(child){child.set("parent",parentId)},this)},add:function(models,options){if(_.isArray(models)){_.each(models,this.applyDefaults.bind(this))}else{this.applyDefaults(models)}return this.set(models,_.extend({merge:false},options,{add:true,remove:false}))},create:function(models,options){options=options||{};return this.add(models,options)},createSection:function(order){return _.first(this.create([{tag:"tailor_section",order:order}],{at:order}))},createRow:function(parentId,order){var row=_.first(this.create([{tag:"tailor_row",parent:parentId,order:order}],{}));return this.create([{tag:"tailor_column",atts:{width:"50%"},parent:row.get("id"),order:0},{tag:"tailor_column",atts:{width:"50%"},parent:row.get("id"),order:1}])},createColumn:function(parentId,order){return _.first(this.create([{tag:"tailor_column",parent:parentId,order:order}]))},createContainer:function(model,parentId,order,descendants){var tag=model.get("tag");var container=_.first(this.create([{tag:tag,parent:parentId,order:order}],{at:order,silent:true}));var childTag=model.get("child");var children=this.create([{tag:childTag,parent:container.get("id"),order:0},{tag:childTag,parent:container.get("id"),order:1}],{silent:true});if(descendants){_.first(descendants).set("parent",_.first(children).get("id"),{silent:true});_.last(descendants).set("parent",_.last(children).get("id"),{silent:true})}this.trigger("add",container,this,{})},createWrapper:function(tag,parentId,order,child){var wrapper=_.first(this.create([{tag:tag,parent:parentId,order:order}],{silent:true}));if("undefined"==typeof child){this.create([{tag:"tailor_content",parent:wrapper.get("id"),order:0}],{silent:true})}this.trigger("add",wrapper,this,{});if("undefined"!=typeof child){this.insertChild(child,wrapper)}return wrapper},createChild:function(model){var child=_.first(this.create([{tag:model.get("child"),parent:model.get("id"),order:this.getChildren(model).length}],{silent:true}));this.create([{tag:"tailor_content",parent:child.get("id"),order:0}],{silent:true});this.trigger("add",child,this,{});return child},insertChild:function(child,parent){if(!child){return}if(child.get("parent")!==parent.get("id")){child.trigger("remove:child")}parent.trigger("insert",child);child.trigger("add:child");child.set("parent",parent.get("id"))},_reBalanceColumns:function(model){var children=this.where({parent:model.get("id")});var numberChildren=children.length;_.each(children,function(child){var atts=_.clone(child.get("atts"));atts["width"]=Math.round(parseFloat(1/numberChildren)*1e3)/10+"%";delete atts["width_tablet"];delete atts["width_mobile"];child.set("atts",atts,{silent:true});child.trigger("change:width",child,atts)},this)},_checkParent:function(model){if(!model){return}if("container"==model.get("type")){this._checkCollapsibleContainer(model)}this._checkChildren(model)},_checkChildren:function(model){var children=this.where({parent:model.get("id")});if(0===children.length){model.trigger("destroy",model)}},_checkCollapsibleContainer:function(model){var childTag=this.getElementDefinitions().findWhere({tag:model.get("tag")}).get("child");var containerId=model.get("id");var children=this.filter(function(element){return containerId===element.get("parent")&&childTag===element.get("tag")});if(0===children.length){model.trigger("container:collapse",model,this.where({parent:containerId}))}else if(1===children.length){var child=_.first(children);if("tailor_row"===model.get("tag")){child.trigger("container:collapse",child,this.where({parent:child.get("id")}))}}}});module.exports=ElementCollection},{}],22:[function(require,module,exports){var ChildModel=require("./../element-child"),ColumnModel;ColumnModel=ChildModel.extend({validTarget:function(that,region){if(_.contains(["tailor_section","tailor_row"],that.get("tag"))||!_.contains(["left","right"],region)){return false}if("child"==that.get("type")&&that.get("tag")!=this.get("tag")){return false}var siblings=this.collection.getSiblings(this);return that.get("parent")==this.get("parent")||siblings.length<6}});module.exports=ColumnModel},{"./../element-child":28}],23:[function(require,module,exports){var ChildModel=require("./../element-child"),GridItemModel;GridItemModel=ChildModel.extend({validTarget:function(that,region){if("tailor_section"==that.get("tag")||_.contains(["top","bottom","center"],region)){return false}var parent=this.collection.getParent(this);if(parent.get("tag")==that.get("tag")){return false}return that.get("tag")==this.get("tag")}});module.exports=GridItemModel},{"./../element-child":28}],24:[function(require,module,exports){var ContainerModel=require("./../element-container"),CarouselModel;CarouselModel=ContainerModel.extend({createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();var $navigation=view.$el.find(".slick-dots").detach();this.appendTemplate(id,view);$childViewContainer.append($children);$navigation.insertAfter($childViewContainer);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=CarouselModel},{"./../element-container":30}],25:[function(require,module,exports){var ContainerModel=require("./../element-container"),RowModel;RowModel=ContainerModel.extend({validTarget:function(that,region){if("child"==that.get("type")||"tailor_section"==that.get("tag")||"center"==region){return false}return _.contains(["top","bottom"],region)&&"tailor_column"!=that.get("tag")}});module.exports=RowModel},{"./../element-container":30}],26:[function(require,module,exports){var ContainerModel=require("./../element-container"),TabsModel;TabsModel=ContainerModel.extend({createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();var $navigation=view.$el.find(".tailor-tabs__navigation");var $navigationItems=$navigation.children().detach();this.appendTemplate(id,view);$childViewContainer.append($children);$navigation.append($navigationItems);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=TabsModel},{"./../element-container":30}],27:[function(require,module,exports){var Model;Backbone.Model.prototype.set=_.wrap(Backbone.Model.prototype.set,function(oldSet,key,val,options){if(key==null)return this;var attrs;if(typeof key==="object"){attrs=key;options=val}else{(attrs={})[key]=val}options||(options={});var ret=oldSet.call(this,attrs,options);if(this._tracking){_.each(attrs,_.bind(function(val,key){if(_.isEqual(this._original[key],val)){delete this._unsaved[key]}else{this._unsaved[key]=val}},this))}return ret});Model=Backbone.Model.extend({_tracking:false,_original:{},_unsaved:{},defaults:function(){return{id:this.cid,tag:"",label:"",atts:{},parent:"",order:0,collection:"element"}},isTracking:function(){return this._tracking},startTracking:function(){this._tracking=true;this.resetTracking();return this},stopTracking:function(){this._tracking=false;this._original={};this._unsaved={};return this},resetTracking:function(){this._original=_.clone(this.attributes);this._unsaved={};return this},resetAttributes:function(){if(!this._tracking){return}this.attributes=this._original;this.resetTracking();this.trigger("change:atts",this,this.get("atts"));return this},toShortcode:function(){var tag=this.get("tag");var atts=this.get("atts");var content="";var shortcode="["+tag;_.each(atts,function(attr,id){if(attr){if("content"===id){content=attr}else{if(_.isNumber(id)){if(/\s/.test(attr)){shortcode+=' "'+attr+'"'}else{shortcode+=" "+attr}}else{shortcode+=" "+id+'="'+attr+'"'}}}},this);return shortcode+"]"+content+"[/"+tag+"]"},insertBefore:function(view){this.trigger("remove:child");this.trigger("insert:before",view);this.trigger("add:child");this.set("parent",view.model.get("parent"))},insertAfter:function(view){this.trigger("remove:child");this.trigger("insert:after",view);this.trigger("add:child");this.set("parent",view.model.get("parent"))},columnBefore:function(view){var model=view.model;var parent=model.get("parent");if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(parent,model.get("order")-1);this.collection.insertChild(this,column)}else{var columns=this.collection.createRow(parent,model.get("order"));this.collection.insertChild(this,_.first(columns));this.collection.insertChild(model,_.last(columns))}},columnAfter:function(view){var model=view.model;var parent=model.get("parent");if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(parent,model.get("order"));this.collection.insertChild(this,column)}else{var columns=this.collection.createRow(parent,model.get("order"));this.collection.insertChild(model,_.first(columns));this.collection.insertChild(this,_.last(columns))}},beforeCopyElement:function(view){var el=view.el;view.triggerAll("before:element:copy",view);el.classList.remove("is-dragging");el.classList.remove("is-hovering");el.classList.remove("is-selected");el.classList.remove("is-editing")},appendTemplate:function(id,view){var oldId=view.model.get("id");var template=document.createElement("script");template.setAttribute("type","text/html");template.id="tmpl-tailor-"+id;template.innerHTML=view.el.outerHTML.replace(oldId,id);document.body.appendChild(template)},afterCopyElement:function(id,view){var oldId=view.model.get("id");view.$el.trigger("element:copy",view);app.channel.trigger("css:copy",oldId,id)}});module.exports=Model},{}],28:[function(require,module,exports){var CompositeModel=require("./element-composite"),ChildModel;ChildModel=CompositeModel.extend({validTarget:function(that,region){if("tailor_section"==that.get("tag")||_.contains(["left","right","center"],region)){return false}var parent=this.collection.getParent(this);if(parent.get("tag")==that.get("tag")){return false}return that.get("tag")==this.get("tag")},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.insertBefore);this.listenTo(this,"element:move:right",this.insertAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyBefore);this.listenTo(this,"element:copy:right",this.copyAfter)}});module.exports=ChildModel},{"./element-composite":29}],29:[function(require,module,exports){var BaseModel=require("./element-base"),CompositeModel;CompositeModel=BaseModel.extend({cloneContainer:function(sourceView,parent,index){var collection=this.collection;var clone=sourceView.model.clone();clone.set("id",clone.cid);clone.set("parent",parent);clone.set("order",index);this.createTemplate(clone.cid,sourceView);var clonedChildren=this.cloneChildren(sourceView.children,clone,[]);collection.add(clonedChildren,{silent:true});collection.add(clone);sourceView.triggerMethod("element:refresh")},cloneChildren:function(childViews,parent,clones){if(childViews.length){childViews.each(function(childView){var clone=childView.model.clone();clone.set("id",clone.cid);clone.set("parent",parent.get("id"));clone.createTemplate(clone.cid,childView);clones.push(clone);if(childView.children){this.cloneChildren(childView.children,clone,clones)}},this)}return clones},copyBefore:function(targetView,sourceView){this.cloneContainer(sourceView,targetView.model.get("parent"),targetView.model.get("order")-1)},copyAfter:function(targetView,sourceView){this.cloneContainer(sourceView,targetView.model.get("parent"),targetView.model.get("order"))},copyColumnBefore:function(targetView,sourceView){var parent=targetView.model.get("parent");if("tailor_column"===targetView.model.get("tag")){var column=this.collection.createColumn(parent,targetView.model.get("order")-1);this.cloneContainer(sourceView,column.get("id"),0)}else{var columns=this.collection.createRow(parent,targetView.model.get("order"));this.collection.insertChild(targetView.model,_.last(columns));this.cloneContainer(sourceView,_.first(columns).get("id"),0)}},copyColumnAfter:function(targetView,sourceView){var parent=targetView.model.get("parent");if("tailor_column"===targetView.model.get("tag")){var column=this.collection.createColumn(parent,targetView.model.get("order"));this.cloneContainer(sourceView,column.get("id"),0)}else{var columns=this.collection.createRow(parent,targetView.model.get("order"));this.collection.insertChild(targetView.model,_.first(columns));this.cloneContainer(sourceView,_.last(columns).get("id"),0)}},createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();this.appendTemplate(id,view);$childViewContainer.append($children);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=CompositeModel},{"./element-base":27}],30:[function(require,module,exports){var CompositeModel=require("./element-composite"),ContainerModel;ContainerModel=CompositeModel.extend({validTarget:function(that,region){if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("center"==region){return"container"!=that.get("type")}if(_.contains(["wrapper","child"],parent.get("type"))){if(_.contains(["top","bottom"],region)){return _.contains(["tailor_section","tailor_column"],parent.get("tag"))||!_.contains(["container","wrapper","child"],that.get("type"))}return"tailor_section"==parent.get("tag")||!_.contains(["left","right"],region)}return"container"!=that.get("type")},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter)}});module.exports=ContainerModel},{"./element-composite":29}],31:[function(require,module,exports){var CompositeModel=require("./element-composite"),WrapperModel;WrapperModel=CompositeModel.extend({validTarget:function(that,region){if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))||"center"==region){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("child"==parent.get("type")&&"tailor_column"!=parent.get("tag")){return"container"!=that.get("type")&&!_.contains(["left","right"],region)}if(_.contains(["container","wrapper","child"],parent.get("type"))){return"tailor_section"==parent.get("tag")||!_.contains(["left","right"],region)}return true},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter);this.listenTo(this,"element:move:center",this.createChild);this.listenTo(this,"element:copy:center",this.copyChild)},createChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;this.createTemplate(sourceView.model.get("id"),sourceView);this.collection.createWrapper(childTag,id,numberChildren,sourceView.model)},copyChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;var wrapper=this.collection.createWrapper(childTag,id,numberChildren,false);this.cloneContainer(sourceView,wrapper.get("id"),0)}});module.exports=WrapperModel},{"./element-composite":29}],32:[function(require,module,exports){var BaseModel=require("./element-base"),ElementModel;ElementModel=BaseModel.extend({validTarget:function(that,region,threshold){if(threshold<20){return false}if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))||"center"==region){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("child"==parent.get("type")&&"tailor_column"!=parent.get("tag")){return"container"!=that.get("type")&&!_.contains(["left","right"],region)}if(_.contains(["wrapper","child"],parent.get("type"))){if(_.contains(["top","bottom"],region)){return _.contains(["tailor_section","tailor_column"],parent.get("tag"))||!_.contains(["container","wrapper","child"],that.get("type"))}return"tailor_section"==parent.get("tag")||_.contains(["left","right"],region)}return true},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter);this.listenTo(this,"element:move:center",this.createChild);this.listenTo(this,"element:copy:center",this.copyChild)},copyBefore:function(targetView,sourceView){var clone=sourceView.model.clone();var index=targetView.model.get("order")-1;clone.set("id",clone.cid);clone.set("parent",targetView.model.get("parent"));clone.set("order",index);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},copyAfter:function(targetView,sourceView){var clone=sourceView.model.clone();var index=targetView.model.get("order");clone.set("id",clone.cid);clone.set("parent",targetView.model.get("parent"));clone.set("order",index);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},copyColumnBefore:function(targetView,sourceView){var model=targetView.model;var clone=sourceView.model.clone();clone.set("id",clone.cid);this.createTemplate(clone.cid,sourceView);if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(model.get("parent"),model.get("order")-1);clone.set("parent",column.get("id"));this.collection.add(clone)}else{var columns=this.collection.createRow(model.get("parent"),model.get("order"));this.collection.insertChild(model,_.last(columns));clone.set("parent",_.first(columns).get("id"));this.collection.add(clone)}},copyColumnAfter:function(targetView,sourceView){var model=targetView.model;var clone=sourceView.model.clone(); clone.set("id",clone.cid);this.createTemplate(clone.cid,sourceView);if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(model.get("parent"),model.get("order"));clone.set("parent",column.get("id"));this.collection.add(clone)}else{var columns=this.collection.createRow(model.get("parent"),model.get("order"));this.collection.insertChild(model,_.first(columns));clone.set("parent",_.last(columns).get("id"));this.collection.add(clone)}},createChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;this.appendTemplate(sourceView.model.get("id"),sourceView);this.collection.createWrapper(childTag,id,numberChildren,sourceView.model)},copyChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;var wrapper=this.collection.createWrapper(childTag,id,numberChildren,false);var clone=sourceView.model.clone();clone.set("id",clone.cid);clone.set("parent",wrapper.get("id"));clone.set("order",0);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);this.appendTemplate(id,view);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=ElementModel},{"./element-base":27}],33:[function(require,module,exports){var WrapperModel=require("./../element-wrapper"),SectionModel;SectionModel=WrapperModel.extend({validTarget:function(that,region){return"tailor_section"==that.get("tag")&&!_.contains(["left","right","center"],region)}});module.exports=SectionModel},{"./../element-wrapper":31}],34:[function(require,module,exports){var CanvasRegion=Backbone.Marionette.Region.extend({initialize:function(){this.listenTo(app.channel,"canvas:dragstart",this.onDragStart);this.listenTo(app.channel,"canvas:dragend",this.onDragEnd)},onDragStart:function(view,region,options){this.el.classList.add("is-active")},onDragEnd:function(view,region,options){this.el.classList.remove("is-active")}});module.exports=CanvasRegion},{}],35:[function(require,module,exports){var $=Backbone.$,$win=$(window),$doc=$(document),CanvasCollectionView=require("./show/canvas-view"),CanvasModule;CanvasModule=Marionette.Module.extend({onStart:function(){this._model=null;this._isDragging=false;this.collection=app.channel.request("canvas:elements");this.addEventListeners();this.showCanvas();app.channel.trigger("module:canvas:ready",this)},addEventListeners:function(){this.listenTo(app.channel,"canvas:dragstart",this.onDragStart);this.listenTo(app.channel,"canvas:dragover",this.onDragOver);this.listenTo(app.channel,"canvas:dragend",this.onDragEnd);this.listenTo(app.channel,"canvas:drop",this.onDrop);$doc.on("click dragover",this.reset.bind(this));$win.on("resize",this.reset.bind(this))},showCanvas:function(){app.canvasRegion.show(new CanvasCollectionView({collection:this.collection}))},onDragStart:function(e,view){var collection=view.model.collection;if("function"===typeof collection.hasSelectedParent&&collection.hasSelectedParent(view.model)){return}this._view=view;this._model=view.model;this._isDragging=true;view.el.classList.add("is-dragging");if("element"==view.model.get("collection")){var testVar=window.DataTransfer||window.Clipboard;if("setDragImage"in testVar.prototype){var dragImage=document.createElement("img");dragImage.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";e.dataTransfer.setDragImage(dragImage,0,0)}}e.dataTransfer.effectAllowed="copyMove";e.dataTransfer.setData("Text",this._model.cid);e.stopPropagation()},onDragOver:function(e,view){if(!this._isDragging){return}if(e.pageY){var scrollY=window.scrollY||document.documentElement.scrollTop;if(e.pageY-scrollY<40){window.scrollTo(0,scrollY-20)}else if(scrollY+window.innerHeight-e.pageY<40){window.scrollTo(0,scrollY+20)}}var action="element"===this._model.get("collection")&&e.shiftKey?"copy":"move";if("move"===action&&view.model===this._model){this.reset();e.stopPropagation();return}var region=this._getDropRegion(e,view);if(!view.model.validTarget(this._model,region)){return}e.dataTransfer.dropEffect=action;app.channel.trigger("canvas:guide",view,region);e.preventDefault();e.stopPropagation()},onDrop:function(e,view){if(!this._isDragging){return}var model=this._model;var region=this._getDropRegion(e,view);if(!view.model.validTarget(model,region)){return}var action;if("element"===model.get("collection")){action=e.shiftKey?"copy":"move";if("move"===action&&view.model===model){return}}else{action="add"}model.trigger("element:"+action+":"+region,view,this._view);app.channel.trigger("element:"+action,model);this.collection.sort({silent:true});e.preventDefault();e.stopPropagation()},onDragEnd:function(e,view){if(!this._isDragging){return}this._isDragging=false;this._view.el.classList.remove("is-dragging");this.reset()},reset:function(){app.channel.trigger("canvas:reset")},_getPoint:function(e){if(e.targetTouches){return{x:e.targetTouches[0].clientX,y:e.targetTouches[0].clientY}}return{x:e.clientX,y:e.clientY}},_getDropRegion:function(e,view){var point=this._getPoint(e);var rect=view.el.getBoundingClientRect();var width=rect.width/2;var height=rect.height/2;var top=rect.top+(rect.height-height)/2;var left=rect.left+(rect.width-width)/2;if(left<=point.x&&point.x<=left+width&&top<=point.y&&point.y<=top+height){return"center"}else{var x=(point.x-(rect.left+width))/width;var y=(point.y-(rect.top+height))/height;if(Math.abs(x)>Math.abs(y)){return x>0?"right":"left"}return y>0?"bottom":"top"}}});module.exports=CanvasModule},{"./show/canvas-view":36}],36:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({behaviors:{Container:{}},getChildView:function(){return Tailor.lookup("tailor_section","wrapper","Views")},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return!child.get("parent")},_updateIndices:function(view,increment,index){if(increment){view._index=index;view.model._changing=false;view.model.set("order",index)}this.children.each(function(laterView){if(laterView._index>=view._index){laterView._index+=increment?1:-1;laterView.model.set("order",laterView._index)}},this)},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}}})},{}],37:[function(require,module,exports){var Stylesheet=require("./stylesheet"),CSSModule;CSSModule=Marionette.Module.extend({onStart:function(options){this.stylesheets=[];this.collection=app.channel.request("canvas:elements");this.createSheets(options.mediaQueries||{});this.addRules(options.cssRules||{});this.addEventListeners();app.channel.trigger("module:css:ready",this)},addEventListeners:function(){this.listenTo(app.channel,"css:add",this.addRules);this.listenTo(app.channel,"css:delete",this.deleteRules);this.listenTo(app.channel,"css:update",this.updateRules);this.listenTo(app.channel,"css:copy",this.copyRules);this.listenTo(app.channel,"css:clear",this.clearRules);this.listenTo(this.collection,"destroy",this.onDestroy)},createSheet:function(id,min,max){var media="only screen";if(min){media+=" and (min-width: "+min+")"}if(max){media+=" and (max-width: "+max+")"}return new Stylesheet(id,media)},createSheets:function(mediaQueries){_.each(mediaQueries,function(atts,id){if(!_.isEmpty(atts.min)){if(!_.isEmpty(atts.max)){this.stylesheets[id+"-up"]=this.createSheet(id+"-up",atts.min);this.stylesheets[id]=this.createSheet(id,atts.min,atts.max)}else{this.stylesheets[id]=this.createSheet(id,atts.min)}}else{if(!_.isEmpty(atts.max)){this.stylesheets[id]=this.createSheet(id,null,atts.max)}else{this.stylesheets[id]=this.createSheet(id)}}},this);app.channel.trigger("module:css:stylesheets:ready",this)},getSheet:function(id){if(this.stylesheets.hasOwnProperty(id)){return this.stylesheets[id]}return false},addRules:function(cssRules){for(var queryId in cssRules){if(cssRules.hasOwnProperty(queryId)){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].addRules(cssRules[queryId])}}}},clearRules:function(){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].clearRules()}}},copyRules:function(elementId,newElementId){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){var rules=this.stylesheets[queryId].getRules(elementId);if(rules.length){for(var rule in rules){if(rules.hasOwnProperty(rule)){rules[rule].selectors=rules[rule].selectors.replace(new RegExp(elementId,"g"),newElementId)}}var rulesSet={};rulesSet[queryId]={};rulesSet[queryId][newElementId]=rules;this.addRules(rulesSet)}}}},deleteRules:function(elementId,settingId){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].deleteRules(elementId,settingId)}}},updateRules:function(elementId,cssRules){this.deleteRules(elementId);this.addRules(cssRules)},onReset:function(){this.clearRules()},onDestroy:function(model){this.deleteRules(model.get("id"))}});module.exports=CSSModule},{"./stylesheet":38}],38:[function(require,module,exports){function Stylesheet(id,media){this.id=id;this.initialize(media)}Stylesheet.prototype={initialize:function(media){this.stylesheet=this.createStylesheet(media);this.sheet=this.stylesheet.sheet;this.lookup=[]},createStylesheet:function(media){var style=document.createElement("style");style.appendChild(document.createTextNode(""));media=media||"screen";style.setAttribute("media",media);style.setAttribute("id","tailor-"+this.id);document.head.appendChild(style);return style},addRules:function(ruleSet){for(var elementId in ruleSet){if(ruleSet.hasOwnProperty(elementId)){this.lookup=this.lookup||[];for(var i in ruleSet[elementId]){if(ruleSet[elementId].hasOwnProperty(i)){this.addRule(elementId,ruleSet[elementId][i])}}}}},addRule:function(elementId,rule){if(this.checkRule(rule)){var selectors=Tailor.CSS.parseSelectors(rule["selectors"],elementId);var declarations=Tailor.CSS.parseDeclarations(rule["declarations"]);if(!_.isEmpty(declarations)){var settingId=rule["setting"];Tailor.CSS.addRule(this.sheet,selectors,declarations,this.lookup.length);this.lookup.push({elementId:elementId,settingId:settingId})}}},checkRule:function(rule){return _.has(rule,"selectors")&&_.has(rule,"declarations")&&_.has(rule,"setting")},getRules:function(elementId){var rules=[];for(var i=0;i-1){rules.push({selectors:rule.selectorText,declarations:rule.style.cssText,setting:this.lookup[i]["settingId"]||""})}}}return rules},deleteRules:function(elementId,settingId){for(var i=0;i1){module.collection.add(parents,{at:index+1})}else{parents[0].parent=parent;parents[0].order=index;module.collection.add(parents)}app.channel.trigger("template:add",model)}canvas.classList.remove("is-loading")}})}};app.channel.on("template:load",api.loadTemplate);app.channel.trigger("module:templates:ready",this)}});module.exports=TemplateModule},{}],41:[function(require,module,exports){var SelectRegion=Backbone.Marionette.Region.extend({onShow:function(view,region,options){view._view.el.classList.add("is-selected")},onEmpty:function(view,region,options){view._view.el.classList.remove("is-selected")}});module.exports=SelectRegion},{}],42:[function(require,module,exports){var GuideView=Marionette.ItemView.extend({template:false,position:function(view,drop){var $el=view.$el;var offset=$el.offset();var parentOffset=this.$el.offsetParent().offset();this.el.style.visibility="visible";this.el.className="guide guide--"+drop+" guide--"+view.model.get("tag");this.el.style.left=offset.left-parentOffset.left+"px";this.el.style.top=offset.top-parentOffset.top+"px";this.el.style.width=$el.outerWidth()+"px";this.el.style.height=$el.outerHeight()+"px";this.el.style.opacity=1},reset:function(){this.el.style="";this.el.style.visibility="hidden";this.el.style.opacity=0}});module.exports=GuideView},{}],43:[function(require,module,exports){var SelectMenuItemView=Marionette.ItemView.extend({tagName:"div",className:"select__item",events:{click:"onClick"},getTemplate:function(){return _.template("<%= label %>")},onClick:function(e){if(0===this._index){this.triggerMethod("toggle")}else{this.model.trigger("select")}e.stopPropagation()}});module.exports=SelectMenuItemView},{}],44:[function(require,module,exports){var SelectMenuItemView=require("./select-menu-item"),SelectMenuView;SelectMenuView=Marionette.CompositeView.extend({className:"select",childView:SelectMenuItemView,childViewContainer:".select__menu",ui:{add:".js-add",edit:".js-edit",copy:".js-copy",delete:".js-delete"},events:{"click @ui.add":"addElement","click @ui.edit":"editElement","click @ui.copy":"copyElement","click @ui.delete":"deleteElement"},modelEvents:{destroy:"destroy"},childEvents:{toggle:"toggleMenu"},template:"#tmpl-tailor-tools-select",serializeData:function(){var data=Backbone.Marionette.CompositeView.prototype.serializeData.apply(this,arguments);data.type=this.model.get("type");data.siblings=this.collection.where({parent:this.model.get("parent")}).length;return data},initialize:function(options){this._view=options.view},_filteredSortedModels:function(){var models=[];var model=this.model;while("undefined"!==typeof model){models.push(model);model=this.collection.get(model.get("parent"))}return models},onDomRefresh:function(){var thisRect=this.el.parentNode.getBoundingClientRect();var thatRect=this._view.el.getBoundingClientRect();var style=getComputedStyle(this._view.el,null);var borderTop=parseInt(style.getPropertyValue("border-top-width"),10);var borderRight=parseInt(style.getPropertyValue("border-right-width"),10);var borderBottom=parseInt(style.getPropertyValue("border-bottom-width"),10);var borderLeft=parseInt(style.getPropertyValue("border-left-width"),10);var left=Math.round(parseFloat(thatRect.left))+borderLeft;var right=Math.min(window.innerWidth+1,Math.round(thatRect.right)-borderRight);var width=right-left;this.el.style.top=Math.round(parseFloat(thatRect.top-parseFloat(thisRect.top)))+borderTop+"px";this.el.style.left=left-thisRect.left+"px";this.el.style.width=width+"px";this.el.style.height=Math.round(parseFloat(thatRect.height))-borderTop-borderBottom+"px";var controls=this.el.querySelector(".select__controls");var menu=this.el.querySelector(".select__menu");if(menu&&controls){var menuRect=menu.getBoundingClientRect();var controlsRect=controls.getBoundingClientRect();if(menuRect.width+controlsRect.width>parseInt(this.el.style.width,10)){this.el.classList.add("is-minimal")}}},addElement:function(){var child=this.model.collection.createChild(this.model);child.set("collection","library",{silent:true});app.channel.trigger("element:add",child)},editElement:function(){app.channel.trigger("modal:open",this.model)},copyElement:function(){this.model.copyAfter(this._view,this._view);app.channel.trigger("element:copy",this.model)},deleteElement:function(){this.model.trigger("destroy",this.model);app.channel.trigger("element:delete",this.model)},toggleMenu:function(){this.$el.toggleClass("is-expanded")}});module.exports=SelectMenuView},{"./select-menu-item":43}],45:[function(require,module,exports){var GuideView=require("./show/guide"),SelectorView=require("./show/select-menu"),ToolsModule;ToolsModule=Marionette.Module.extend({onStart:function(){var guide=new GuideView({el:"#guide"}).render();var api={positionGuide:function(view,drop){guide.position(view,drop)},selectElement:function(view){app.selectRegion.show(new SelectorView({model:view.model,collection:app.channel.request("canvas:elements"),view:view}))},resetGuide:function(){guide.reset();app.selectRegion.empty()},getSelectedElement:function(){var select=app.selectRegion.currentView;return select?select.model:null}};this.listenTo(app.channel,"canvas:guide",api.positionGuide);this.listenTo(app.channel,"canvas:select",api.selectElement);this.listenTo(app.channel,"canvas:reset",api.resetGuide);this.listenTo(app.channel,"element:refresh:template",api.resetGuide);app.channel.reply("canvas:element:selected",api.getSelectedElement);app.channel.trigger("module:tools:ready",this)}});module.exports=ToolsModule},{"./show/guide":42,"./show/select-menu":44}],46:[function(require,module,exports){require("./preview/helpers");require("./preview/behaviors");require("./preview/css")},{"./preview/behaviors":47,"./preview/css":48,"./preview/helpers":49}],47:[function(require,module,exports){(function($,app,SettingAPI,ElementAPI){ElementAPI.onRender("tailor_carousel",function(atts,model){var carousel=this;var options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:false,fade:"1"==atts.fade&&"1"==atts.items_per_row,slidesToShow:parseInt(atts.items_per_row,10)||1,adaptiveHeight:true};carousel.$el.tailorCarousel(options)});ElementAPI.onRender("tailor_content",function(atts,model){if(this.$el.find(".is-lightbox-image").length>0){this.$el.tailorLightbox({disableOn:function(){return $el.hasClass("is-selected")}})}});ElementAPI.onRender("tailor_gallery",function(atts,model){var $el=this.$el;var options;if("carousel"==atts.layout){options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:"1"==atts.dots,fade:"1"==atts.fade&&"1"==atts.items_per_row,infinite:false,slidesToShow:parseInt(atts.items_per_row,10)||2};$el.tailorSimpleCarousel(options)}else if("slideshow"==atts.layout){options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:false,fade:true,items:".tailor-slideshow__slide",adaptiveHeight:true,draggable:false,speed:250};if("1"==atts.thumbnails){options.customPaging=function(slider,i){var thumb=$(slider.$slides[i]).data("thumb");return''};options.dots=true}$el.tailorSlideshow(options)}else if(atts.masonry){$el.tailorMasonry()}if(this.el.classList.contains("is-lightbox-gallery")){$el.tailorLightbox({disableOn:function(){return $el.hasClass("is-selected")}})}});ElementAPI.onRender("tailor_map",function(atts,model){this.$el.tailorGoogleMap()});ElementAPI.onRender("tailor_posts",function(atts,model){var $el=this.$el;var options;if("carousel"==atts.layout){options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:"1"==atts.dots,fade:"1"==atts.fade&&"1"==atts.items_per_row,infinite:false,slidesToShow:parseInt(atts.items_per_row,10)||2};this.$el.tailorSimpleCarousel(options)}else if(atts.masonry){$el.tailorMasonry()}});ElementAPI.onRender("tailor_section",function(atts,model){if(atts["background_image"]&&atts["parallax"]&&1==atts["parallax"]){this.$el.tailorParallax()}});ElementAPI.onRender("tailor_tabs",function(atts,model){this.$el.tailorTabs()});ElementAPI.onRender("tailor_toggles",function(atts,model){this.$el.tailorToggles()})})(window.jQuery,window.app,window.Tailor.Api.Setting,window.Tailor.Api.Element)},{}],48:[function(require,module,exports){var $=Backbone.$,$win=$(window);(function(window,app,SettingAPI){var cssRules=window._pageRules||[];var cssCollection={_tailor_section_width:"",_tailor_column_spacing:"",_tailor_element_spacing:"",_tailor_page_css:""};var stylesheet=document.createElement("style");stylesheet.appendChild(document.createTextNode(""));stylesheet.setAttribute("media","screen");stylesheet.setAttribute("id","tailor-settings");document.head.appendChild(stylesheet);function getStyleValues(string){var values;if(-1!=string.indexOf(",")){values=string.split(",")}else{values=string.split("-")}if(2==values.length){values=_.object(["top","bottom"],values)}else if(4==values.length){values=_.object(["top","right","bottom","left"],values)}else{values={}}return values}function getMediaQuery(string){var query="";_.each(["_tablet","_mobile"],function(target){if(string.substring(string.length-target.length)==target){query=target.substring(1)}});return query}function generateCSS(settingId,value){cssCollection[settingId]="";value=_.isString(value)?value.trim():value;if(!_.isEmpty(value)){_.each(cssRules[settingId],function(rule){var selectors=Tailor.CSS.parseSelectors(rule.selectors);var declarations=Tailor.CSS.parseDeclarations(rule.declarations).replace(/\{\{(.*?)\}\}/g,value);cssCollection[settingId]+="\n"+selectors+" {"+declarations+"}"})}}function updateStylesheet(){var value="";for(var settingId in cssCollection){if(cssCollection.hasOwnProperty(settingId)){value+=cssCollection[settingId]}}stylesheet.innerHTML=value;$win.trigger("resize")}app.channel.on("module:css:stylesheets:ready",function(cssModule){var settings=app.channel.request("sidebar:settings");if(settings&&settings.length){settings.each(function(setting){var id=setting.get("id");var value=setting.get("value");value=_.isString(value)?value.trim():value;if(!_.isEmpty(value)&&cssCollection.hasOwnProperty(id)){if(cssRules.hasOwnProperty(id)){generateCSS(id,value)}else{cssCollection[id]=value}}})}updateStylesheet();var ids=["_tailor_section_width","_tailor_column_spacing","_tailor_element_spacing"];_.each(ids,function(settingId){if(cssRules.hasOwnProperty(settingId)){SettingAPI.onChange("sidebar:"+settingId,function(to,from){generateCSS(settingId,to);updateStylesheet()})}});SettingAPI.onChange("sidebar:_tailor_page_css",function(to,from){cssCollection["_tailor_page_css"]=to;updateStylesheet()});SettingAPI.onChange("sidebar:_post_title",function(to,from){$("h1, h2, h1 a, h2 a").each(function(){if(from==this.textContent){this.textContent=to}})});window.Tailor.Settings.overrides={"*":{},tailor_button:{color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"color","tailorValidateColor"],background_color:[[".tailor-button__inner"],"background-color","tailorValidateColor"],background_color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"background-color","tailorValidateColor"],border_color:[[".tailor-button__inner"],"border-color","tailorValidateColor"],border_color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"border-color","tailorValidateColor"],padding:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],padding_tablet:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],padding_mobile:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],margin:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],margin_tablet:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],margin_mobile:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],border_width:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_radius:[[".tailor-button__inner"],"border-radius","tailorValidateUnit"],shadow:[[".tailor-button__inner"],"box-shadow"]},tailor_card:{border_color:[["",".tailor-card__header"],"border-color","tailorValidateColor"],padding:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"],padding_tablet:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"],padding_mobile:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"]},tailor_carousel:{border_color:[["",".slick-dots"],"border-color","tailorValidateColor"]},tailor_grid:{border_color:[[".tailor-grid__item"],"border-color","tailorValidateColor"],border_style:function(to,from,model){return[{selectors:["&.tailor-grid--bordered .tailor-grid__item"],declarations:{"border-style":tailorValidateString(to)+"!important"}}]},border_width:function(to,from,model){return[{selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]},border_width_tablet:function(to,from,model){return[{media:"tablet",selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]},border_width_mobile:function(to,from,model){return[{media:"mobile",selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]}},tailor_grid_item:{padding:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"],padding_tablet:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"],padding_mobile:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"]},tailor_tabs:{border_color:[[".tailor-tabs__navigation-item",".tailor-tab"],"border-color","tailorValidateColor"]},tailor_tab:{background_color:[["&.tailor-tabs__navigation-item","&.tailor-tab"],"background-color","tailorValidateColor"],padding:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],padding_tablet:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],padding_mobile:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],border_width:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],background_repeat:[["&.tailor-tab"],"background-repeat","tailorValidateString"],background_position:[["&.tailor-tab"],"background-position","tailorValidateString"],background_size:[["&.tailor-tab"],"background-size","tailorValidateString"],background_attachment:[["&.tailor-tab"],"background-attachment","tailorValidateString"]},tailor_toggle:{border_color:[[".tailor-toggle__title",".tailor-toggle__body"],"border-color","tailorValidateColor"],border_style:[[".tailor-toggle__title",".tailor-toggle__body"],"border-style","tailorValidateString"],border_radius:[[".tailor-toggle__title",".tailor-toggle__body"],"border-radius","tailorValidateUnit"]},tailor_section:{max_width:[[".tailor-section__content"],"max-width","tailorValidateUnit"],max_width_tablet:[[".tailor-section__content"],"max-width","tailorValidateUnit"],max_width_mobile:[[".tailor-section__content"],"max-width","tailorValidateUnit"],min_height:[[".tailor-section__content"],"min-height","tailorValidateUnit"],min_height_tablet:[[".tailor-section__content"],"min-height","tailorValidateUnit"],min_height_mobile:[[".tailor-section__content"],"min-height","tailorValidateUnit"]}};function getDefinition(tag,id,definition){if(window.Tailor.Settings.overrides["*"].hasOwnProperty(id)){return window.Tailor.Settings.overrides["*"][id]}if(window.Tailor.Settings.overrides.hasOwnProperty(tag)&&window.Tailor.Settings.overrides[tag].hasOwnProperty(id)){return window.Tailor.Settings.overrides[tag][id]}return definition}function registerCallbacks(definitions){_.each(definitions,function(definition,id){SettingAPI.onChange("element:"+id,function(to,from,model){definition=getDefinition(model.get("tag"),id,definition);if("function"==typeof definition){return definition.call(this,to,from,model)}if(""==to){return[]}var rule={media:getMediaQuery(id),selectors:definition[0],declarations:{}};if("function"==typeof window[definition[2]]){rule.declarations[definition[1]]=window[definition[2]](to)}else{rule.declarations[definition[1]]=to}return[rule]})})}_.each(["horizontal_alignment","horizontal_alignment_tablet","horizontal_alignment_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){var media=getMediaQuery(id);if(""!=media){media="-"+media}if(from){this.el.classList.remove("u-text-"+from+media)}this.el.classList.add("u-text-"+to+media);if("tailor_list_item"==model.get("tag")){var atts=model.get("atts");if(!_.isEmpty(atts["graphic_background_color"])||!_.isEmpty(atts["graphic_background_color_hover"])){return[{selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==to?"0":"1em","padding-right":"right"==to?"1em":"0"}}]}else{return[{selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}}]}}})});_.each(["vertical_alignment","vertical_alignment_tablet","vertical_alignment_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){var media=getMediaQuery(id);if(""!==media){media="-"+media}if(from){this.el.classList.remove("u-align-"+from+media)}this.el.classList.add("u-align-"+to+media)})});_.each(["size","size_tablet","size_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){if("tailor_button"==model.get("tag")){var media=getMediaQuery(id);if(""!=media){media="-"+media}if(from){this.el.classList.remove("tailor-button--"+from+media)}this.el.classList.add("tailor-button--"+to+media)}})});registerCallbacks({width:[[],"width","tailorValidateUnit"],width_tablet:[[],"width","tailorValidateUnit"],width_mobile:[[],"width","tailorValidateUnit"],max_width:[[],"max-width","tailorValidateUnit"],max_width_tablet:[[],"max-width","tailorValidateUnit"],max_width_mobile:[[],"max-width","tailorValidateUnit"],min_height:[[],"min-height","tailorValidateUnit"],min_height_tablet:[[],"min-height","tailorValidateUnit"],min_height_mobile:[[],"min-height","tailorValidateUnit"], -min_item_height:[[".tailor-grid__item"],"min-height","tailorValidateUnit"]});registerCallbacks({color:[[],"color","tailorValidateColor"],color_hover:[[":hover"],"color","tailorValidateColor"],link_color:[["a"],"color","tailorValidateColor"],link_color_hover:[["a:hover"],"color","tailorValidateColor"],heading_color:[["h1","h2","h3","h4","h5","h6"],"color","tailorValidateColor"],background_color:function(to,from,model){var atts=model.get("atts");if(atts["background_image"]){return false}var definition=getDefinition(model.get("tag"),"background_color",[[],"background-color","tailorValidateColor"]);if("function"==typeof definition){return definition.call(this,to,from,model)}var rule={selectors:definition[0],declarations:{}};if("function"==typeof window[definition[2]]){rule.declarations[definition[1]]=window[definition[2]](to)}else{rule.declarations[definition[1]]=to}return[rule]},background_color_hover:[[":hover"],"background-color","tailorValidateColor"],border_color:[[],"border-color","tailorValidateColor"],border_color_hover:[[":hover"],"border-color","tailorValidateColor"],graphic_color:function(to,from,model){var tag=model.get("tag");if("tailor_box"==tag){return[{selectors:[".tailor-box__graphic"],declarations:{color:tailorValidateColor(to)}}]}else if("tailor_list_item"==tag){return[{selectors:[".tailor-list__graphic"],declarations:{color:tailorValidateColor(to)}}]}},graphic_color_hover:function(to,from,model){var tag=model.get("tag");if("tailor_box"==tag){return[{selectors:[".tailor-box__graphic:hover"],declarations:{color:tailorValidateColor(to)}}]}else if("tailor_list_item"==tag){return[{selectors:[".tailor-list__graphic:hover"],declarations:{color:tailorValidateColor(to)}}]}},graphic_background_color:function(to,from,model){var tag=model.get("tag");var rules=[];if("tailor_box"==tag){if(to){rules.push({selectors:[".tailor-box__graphic"],declarations:{"margin-bottom":"1em","background-color":tailorValidateColor(to),"text-align":"center"}})}}else if("tailor_list_item"==tag){var atts=model.get("atts");var alignment=atts["horizontal_alignment"];if(to){rules.push({selectors:[".tailor-list__graphic"],declarations:{"background-color":tailorValidateColor(to),"text-align":"center"}});rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{if(!_.isEmpty(atts["graphic_background_color_hover"])){rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}})}}}return rules},graphic_background_color_hover:function(to,from,model){var tag=model.get("tag");var rules=[];if("tailor_box"==tag){if(to){rules.push({selectors:[".tailor-box__graphic"],declarations:{"margin-bottom":"1em","text-align":"center"}});rules.push({selectors:[".tailor-box__graphic:hover"],declarations:{"background-color":tailorValidateColor(to)}})}}else if("tailor_list_item"==tag){var atts=model.get("atts");var alignment=atts["horizontal_alignment"];if(to){rules.push({selectors:[".tailor-list__graphic"],declarations:{"text-align":"center"}});rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}});rules.push({selectors:[".tailor-list__graphic:hover"],declarations:{"background-color":tailorValidateColor(to)}})}else{if(!_.isEmpty(atts["graphic_background_color"])){rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}})}}}return rules},title_color:[[".tailor-toggle__title"],"color","tailorValidateColor"],title_background_color:[[".tailor-toggle__title"],"background-color","tailorValidateColor"],navigation_color:function(to,from,model){return[{selectors:[".slick-active button:before"],declarations:{"background-color":tailorValidateColor(to)}},{selectors:[".slick-arrow:not( .slick-disabled )"],declarations:{color:tailorValidateColor(to)}}]}});registerCallbacks({class:function(to,from,model){var classNames;if(!_.isEmpty(from)){classNames=from.trim().split(/\s+(?!$)/g);for(var i in classNames){if(classNames.hasOwnProperty(i)){this.el.classList.remove(classNames[i])}}}if(!_.isEmpty(to)){classNames=to.trim().split(/\s+(?!$)/g);for(var j in classNames){if(classNames.hasOwnProperty(j)){this.el.classList.add(classNames[j])}}}},border_style:[[],"border-style","tailorValidateString"],border_radius:[[],"border-radius","tailorValidateUnit"],background_repeat:[[],"background-repeat","tailorValidateString"],background_position:[[],"background-position","tailorValidateString"],background_size:[[],"background-size","tailorValidateString"],background_attachment:[[],"background-attachment","tailorValidateString"],shadow:function(to,from,model){var definition=getDefinition(model.get("tag"),"shadow",[[]]);if("function"==typeof definition){return definition.call(this,to,from,model)}if(1==to){return[{selectors:definition[0],declarations:{"box-shadow":"0 2px 6px rgba(0, 0, 0, 0.1)"}}]}return[]}});_.each({margin:[[],"margin-{0}","tailorValidateUnit"],margin_tablet:[[],"margin-{0}","tailorValidateUnit"],margin_mobile:[[],"margin-{0}","tailorValidateUnit"],padding:[[],"padding-{0}","tailorValidateUnit"],padding_tablet:[[],"padding-{0}","tailorValidateUnit"],padding_mobile:[[],"padding-{0}","tailorValidateUnit"],border_width:[[],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[[],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[[],"border-{0}-width","tailorValidateUnit"]},function(definition,id){SettingAPI.onChange("element:"+id,function(to,from,model){definition=getDefinition(model.get("tag"),id,definition);if("function"==typeof definition){return definition.call(this,to,from,model)}var rules=[];var rule={media:getMediaQuery(id),selectors:definition[0],declarations:{}};_.each(getStyleValues(to),function(value,position){if("function"==typeof window[definition[3]]){rule.declarations[definition[1].replace("{0}",position)]=window[definition[2]](value)}else{rule.declarations[definition[1].replace("{0}",position)]=value}});if(_.keys(rule.declarations).length>0){rules.push(rule)}return rules})})})})(window,window.app,window.Tailor.Api.Setting)},{}],49:[function(require,module,exports){window.tailorValidateString=function(string){return string.replace(/[0-9]/g,"")};window.tailorValidateNumber=function(string){string=string.replace(/[^0-9,.]+/i,"");return!_.isEmpty(string)?string:"0"};window.tailorValidateColor=function(color){if(/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(color)){return color}if(isRGBA(color)){return color}return""};function isRGBA(color){return/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d*(?:\.\d+)?)\)$/.test(color)}window.tailorValidateUnit=function(value){var sign="";if("-"==value.charAt(0)){sign="-";value=value.substring(1)}return sign+tailorValidateNumber(value)+getUnit(value)};function getUnit(string){var map=["px","%","in","cm","mm","pt","pc","em","rem","ex","vw","vh"];var matches=string.match(new RegExp(map.join("|")));if(matches){return matches[0]}return"px"}},{}],50:[function(require,module,exports){var $=window.jQuery,$win=$(window),app=window.app,cssModule,callbacks={sidebar:[],element:[]};function checkQuery(query){if(!query||!_.contains(_.keys(cssModule.stylesheets),query)){query="all"}return query}var onSidebarChange=function(setting){var settingId=setting.get("id");if(_.isEmpty(callbacks["sidebar"][settingId])){return}_.each(callbacks["sidebar"][settingId],function(callback){callback.apply(window,[setting.get("value"),setting.previous("value")])});$win.trigger("resize")};var onElementChange=function(setting,view){var elementId=view.model.get("id");var settingId=setting.get("id");if(!callbacks["element"].hasOwnProperty(settingId)||0==callbacks["element"][settingId].length){return}if(1==callbacks["element"][settingId].length){cssModule.deleteRules(elementId,settingId)}var ruleSets={};var rules;_.each(callbacks["element"][settingId],function(callback){if("function"==typeof callback){rules=callback.apply(view,[setting.get("value"),setting.previous("value"),view.model]);if(false===rules){view.model.trigger("change:atts",view.model,view.model.get("atts"))}else if(_.isArray(rules)&&rules.length>0){for(var rule in rules){if(rules.hasOwnProperty(rule)){if(!rules[rule].hasOwnProperty("selectors")||!rules[rule].hasOwnProperty("declarations")){continue}var query=checkQuery(rules[rule].media);ruleSets[query]=ruleSets[query]||{};ruleSets[query][elementId]=ruleSets[query][elementId]||[];if(_.keys(rules[rule].declarations).length>0){ruleSets[query][elementId].push({selectors:rules[rule].selectors,declarations:rules[rule].declarations,setting:rules[rule].setting||settingId})}}}cssModule.addRules(ruleSets)}}})};app.listenTo(app.channel,"sidebar:setting:change",onSidebarChange);app.listenTo(app.channel,"element:setting:change",onElementChange);app.channel.on("module:css:stylesheets:ready",function(module){cssModule=module});function registerCallback(type,id,callback){if("function"===typeof callback){callbacks[type][id]=callbacks[type][id]||[];callbacks[type][id].push(callback)}}module.exports={onChange:function(id,callback){var parts=id.split(":");if(parts.length>=2&&_.contains(["sidebar","element"],parts[0])){registerCallback(parts[0],parts[1],callback)}}}},{}],51:[function(require,module,exports){var DraggableBehaviors=Marionette.Behavior.extend({events:{dragstart:"onDragStart",dragend:"onDragEnd",drag:"onDrag"},onDragStart:function(e){app.channel.trigger("canvas:dragstart",e.originalEvent,this.view)},onDrag:function(e){app.channel.trigger("canvas:drag",e.originalEvent,this.view)},onDragEnd:function(e){app.channel.trigger("canvas:dragend",e.originalEvent,this.view)}});module.exports=DraggableBehaviors},{}],52:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],53:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],54:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],55:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],56:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],58:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],59:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},initialize:function(){this.$el.accordion()}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],60:[function(require,module,exports){var $=jQuery,Ajax;Ajax={url:window.ajaxurl,post:function(action,data){return ajax.send({data:_.isObject(action)?action:_.extend(data||{},{action:action})})},send:function(action,options){if(_.isObject(action)){options=action}else{options=options||{};options.data=_.extend(options.data||{},{action:action,tailor:1})}options=_.defaults(options||{},{type:"POST",url:ajax.url,context:this});return $.Deferred(function(deferred){if(options.success){deferred.done(options.success)}var onError=options.error?options.error:ajax.onError;deferred.fail(onError);delete options.success;delete options.error;$.ajax(options).done(function(response){if(response==="1"||response===1){response={success:true}}if(_.isObject(response)&&!_.isUndefined(response.success)){deferred[response.success?"resolveWith":"rejectWith"](this,[response.data])}else{deferred.rejectWith(this,[response])}}).fail(function(){deferred.rejectWith(this,arguments)})}).promise()},onError:function(response){if(!Tailor.Notify){console.error(response);return}if(response&&response.hasOwnProperty("message")){Tailor.Notify(response.message)}else if("0"==response){Tailor.Notify(window._l10n.expired)}else if("-1"==response){Tailor.Notify(window._l10n.invalid)}else{Tailor.Notify(window._l10n.error)}}};window.ajax=Ajax;module.exports=Ajax},{}],61:[function(require,module,exports){var CSS={addRule:function(sheet,selector,declaration,index){if("insertRule"in sheet){sheet.insertRule(selector+" {"+declaration+"}",sheet.cssRules.length)}else if("addRule"in sheet){sheet.addRule(selector,declaration,sheet.cssRules.length)}},deleteRule:function(sheet,index){if("deleteRule"in sheet){sheet.deleteRule(index)}else if("removeRule"in sheet){sheet.removeRule(index)}},parseSelectors:function(selectors,elementId){if(_.isString(selectors)){return selectors}var elementClass=elementId?".tailor-"+elementId:"";var prefix=".tailor-ui ";if(!selectors.length){return prefix+elementClass}selectors=selectors.map(function(selector){if(selector.indexOf("&")>-1){selector=selector.replace("&",elementClass)}else{var firstCharacter=selector.charAt(0);if(":"==firstCharacter||"::"==firstCharacter){selector=elementClass+selector; +min_item_height:[[".tailor-grid__item"],"min-height","tailorValidateUnit"]});registerCallbacks({color:[[],"color","tailorValidateColor"],color_hover:[[":hover"],"color","tailorValidateColor"],link_color:[["a"],"color","tailorValidateColor"],link_color_hover:[["a:hover"],"color","tailorValidateColor"],heading_color:[["h1","h2","h3","h4","h5","h6"],"color","tailorValidateColor"],background_color:function(to,from,model){var atts=model.get("atts");if(atts["background_image"]){return false}var definition=getDefinition(model.get("tag"),"background_color",[[],"background-color","tailorValidateColor"]);if("function"==typeof definition){return definition.call(this,to,from,model)}var rule={selectors:definition[0],declarations:{}};if("function"==typeof window[definition[2]]){rule.declarations[definition[1]]=window[definition[2]](to)}else{rule.declarations[definition[1]]=to}return[rule]},background_color_hover:[[":hover"],"background-color","tailorValidateColor"],border_color:[[],"border-color","tailorValidateColor"],border_color_hover:[[":hover"],"border-color","tailorValidateColor"],graphic_color:function(to,from,model){var tag=model.get("tag");if("tailor_box"==tag){return[{selectors:[".tailor-box__graphic"],declarations:{color:tailorValidateColor(to)}}]}else if("tailor_list_item"==tag){return[{selectors:[".tailor-list__graphic"],declarations:{color:tailorValidateColor(to)}}]}},graphic_color_hover:function(to,from,model){var tag=model.get("tag");if("tailor_box"==tag){return[{selectors:[".tailor-box__graphic:hover"],declarations:{color:tailorValidateColor(to)}}]}else if("tailor_list_item"==tag){return[{selectors:[".tailor-list__graphic:hover"],declarations:{color:tailorValidateColor(to)}}]}},graphic_background_color:function(to,from,model){var tag=model.get("tag");var rules=[];if("tailor_box"==tag){if(to){rules.push({selectors:[".tailor-box__graphic"],declarations:{"margin-bottom":"1em","background-color":tailorValidateColor(to),"text-align":"center"}})}}else if("tailor_list_item"==tag){var atts=model.get("atts");var alignment=atts["horizontal_alignment"];if(to){rules.push({selectors:[".tailor-list__graphic"],declarations:{"background-color":tailorValidateColor(to),"text-align":"center"}});rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{if(!_.isEmpty(atts["graphic_background_color_hover"])){rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}})}}}return rules},graphic_background_color_hover:function(to,from,model){var tag=model.get("tag");var rules=[];if("tailor_box"==tag){if(to){rules.push({selectors:[".tailor-box__graphic"],declarations:{"margin-bottom":"1em","text-align":"center"}});rules.push({selectors:[".tailor-box__graphic:hover"],declarations:{"background-color":tailorValidateColor(to)}})}}else if("tailor_list_item"==tag){var atts=model.get("atts");var alignment=atts["horizontal_alignment"];if(to){rules.push({selectors:[".tailor-list__graphic"],declarations:{"text-align":"center"}});rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}});rules.push({selectors:[".tailor-list__graphic:hover"],declarations:{"background-color":tailorValidateColor(to)}})}else{if(!_.isEmpty(atts["graphic_background_color"])){rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}})}}}return rules},title_color:[[".tailor-toggle__title"],"color","tailorValidateColor"],title_background_color:[[".tailor-toggle__title"],"background-color","tailorValidateColor"],navigation_color:function(to,from,model){return[{selectors:[".slick-active button:before"],declarations:{"background-color":tailorValidateColor(to)}},{selectors:[".slick-arrow:not( .slick-disabled )"],declarations:{color:tailorValidateColor(to)}}]}});registerCallbacks({class:function(to,from,model){var classNames;if(!_.isEmpty(from)){classNames=from.trim().split(/\s+(?!$)/g);for(var i in classNames){if(classNames.hasOwnProperty(i)){this.el.classList.remove(classNames[i])}}}if(!_.isEmpty(to)){classNames=to.trim().split(/\s+(?!$)/g);for(var j in classNames){if(classNames.hasOwnProperty(j)){this.el.classList.add(classNames[j])}}}},border_style:[[],"border-style","tailorValidateString"],border_radius:[[],"border-radius","tailorValidateUnit"],background_repeat:[[],"background-repeat","tailorValidateString"],background_position:[[],"background-position","tailorValidateString"],background_size:[[],"background-size","tailorValidateString"],background_attachment:[[],"background-attachment","tailorValidateString"],shadow:function(to,from,model){var definition=getDefinition(model.get("tag"),"shadow",[[]]);if("function"==typeof definition){return definition.call(this,to,from,model)}if(1==to){return[{selectors:definition[0],declarations:{"box-shadow":"0 2px 6px rgba(0, 0, 0, 0.1)"}}]}return[]}});_.each({margin:[[],"margin-{0}","tailorValidateUnit"],margin_tablet:[[],"margin-{0}","tailorValidateUnit"],margin_mobile:[[],"margin-{0}","tailorValidateUnit"],padding:[[],"padding-{0}","tailorValidateUnit"],padding_tablet:[[],"padding-{0}","tailorValidateUnit"],padding_mobile:[[],"padding-{0}","tailorValidateUnit"],border_width:[[],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[[],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[[],"border-{0}-width","tailorValidateUnit"]},function(definition,id){SettingAPI.onChange("element:"+id,function(to,from,model){definition=getDefinition(model.get("tag"),id,definition);if("function"==typeof definition){return definition.call(this,to,from,model)}var rules=[];var rule={media:getMediaQuery(id),selectors:definition[0],declarations:{}};_.each(getStyleValues(to),function(value,position){if("function"==typeof window[definition[3]]){rule.declarations[definition[1].replace("{0}",position)]=window[definition[2]](value)}else{rule.declarations[definition[1].replace("{0}",position)]=value}});if(_.keys(rule.declarations).length>0){rules.push(rule)}return rules})})})})(window,window.app,window.Tailor.Api.Setting)},{}],49:[function(require,module,exports){window.tailorValidateString=function(string){return string.replace(/[0-9]/g,"")};window.tailorValidateNumber=function(string){string=string.replace(/[^0-9,.]+/i,"");return!_.isEmpty(string)?string:"0"};window.tailorValidateColor=function(color){if(/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(color)){return color}if(isRGBA(color)){return color}return""};function isRGBA(color){return/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d*(?:\.\d+)?)\)$/.test(color)}window.tailorValidateUnit=function(value){var sign="";if("-"==value.charAt(0)){sign="-";value=value.substring(1)}return sign+tailorValidateNumber(value)+getUnit(value)};function getUnit(string){var map=["px","%","in","cm","mm","pt","pc","em","rem","ex","vw","vh"];var matches=string.match(new RegExp(map.join("|")));if(matches){return matches[0]}return"px"}},{}],50:[function(require,module,exports){var $=window.jQuery,$win=$(window),app=window.app,cssModule,callbacks={sidebar:[],element:[]};function checkQuery(query){if(!query||!_.contains(_.keys(cssModule.stylesheets),query)){query="all"}return query}var onSidebarChange=function(setting){var settingId=setting.get("id");if(_.isEmpty(callbacks["sidebar"][settingId])){return}_.each(callbacks["sidebar"][settingId],function(callback){callback.apply(window,[setting.get("value"),setting.previous("value")])});$win.trigger("resize")};var onElementChange=function(setting,view){var elementId=view.model.get("id");var settingId=setting.get("id");if(!callbacks["element"].hasOwnProperty(settingId)||0==callbacks["element"][settingId].length){return}if(1==callbacks["element"][settingId].length){cssModule.deleteRules(elementId,settingId)}var ruleSets={};var rules;_.each(callbacks["element"][settingId],function(callback){if("function"==typeof callback){rules=callback.apply(view,[setting.get("value"),setting.previous("value"),view.model]);if(false===rules){view.model.trigger("change:atts",view.model,view.model.get("atts"))}else if(_.isArray(rules)&&rules.length>0){for(var rule in rules){if(rules.hasOwnProperty(rule)){if(!rules[rule].hasOwnProperty("selectors")||!rules[rule].hasOwnProperty("declarations")){continue}var query=checkQuery(rules[rule].media);ruleSets[query]=ruleSets[query]||{};ruleSets[query][elementId]=ruleSets[query][elementId]||[];if(_.keys(rules[rule].declarations).length>0){ruleSets[query][elementId].push({selectors:rules[rule].selectors,declarations:rules[rule].declarations,setting:rules[rule].setting||settingId})}}}cssModule.addRules(ruleSets)}}})};app.listenTo(app.channel,"sidebar:setting:change",onSidebarChange);app.listenTo(app.channel,"element:setting:change",onElementChange);app.channel.on("module:css:stylesheets:ready",function(module){cssModule=module});function registerCallback(type,id,callback){if("function"===typeof callback){callbacks[type][id]=callbacks[type][id]||[];callbacks[type][id].push(callback)}}module.exports={onChange:function(id,callback){var parts=id.split(":");if(parts.length>=2&&_.contains(["sidebar","element"],parts[0])){registerCallback(parts[0],parts[1],callback)}}}},{}],51:[function(require,module,exports){var DraggableBehaviors=Marionette.Behavior.extend({events:{dragstart:"onDragStart",dragend:"onDragEnd",drag:"onDrag"},onDragStart:function(e){app.channel.trigger("canvas:dragstart",e.originalEvent,this.view)},onDrag:function(e){app.channel.trigger("canvas:drag",e.originalEvent,this.view)},onDragEnd:function(e){app.channel.trigger("canvas:dragend",e.originalEvent,this.view)}});module.exports=DraggableBehaviors},{}],52:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],53:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],54:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],55:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],56:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],58:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],59:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},initialize:function(){this.$el.accordion({header:".tailor-toggle h3"})}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],60:[function(require,module,exports){var $=jQuery,Ajax;Ajax={url:window.ajaxurl,post:function(action,data){return ajax.send({data:_.isObject(action)?action:_.extend(data||{},{action:action})})},send:function(action,options){if(_.isObject(action)){options=action}else{options=options||{};options.data=_.extend(options.data||{},{action:action,tailor:1})}options=_.defaults(options||{},{type:"POST",url:ajax.url,context:this});return $.Deferred(function(deferred){if(options.success){deferred.done(options.success)}var onError=options.error?options.error:ajax.onError;deferred.fail(onError);delete options.success;delete options.error;$.ajax(options).done(function(response){if(response==="1"||response===1){response={success:true}}if(_.isObject(response)&&!_.isUndefined(response.success)){deferred[response.success?"resolveWith":"rejectWith"](this,[response.data])}else{deferred.rejectWith(this,[response])}}).fail(function(){deferred.rejectWith(this,arguments)})}).promise()},onError:function(response){if(!Tailor.Notify){console.error(response);return}if(response&&response.hasOwnProperty("message")){Tailor.Notify(response.message)}else if("0"==response){Tailor.Notify(window._l10n.expired)}else if("-1"==response){Tailor.Notify(window._l10n.invalid)}else{Tailor.Notify(window._l10n.error)}}};window.ajax=Ajax;module.exports=Ajax},{}],61:[function(require,module,exports){var CSS={addRule:function(sheet,selector,declaration,index){if("insertRule"in sheet){sheet.insertRule(selector+" {"+declaration+"}",sheet.cssRules.length)}else if("addRule"in sheet){sheet.addRule(selector,declaration,sheet.cssRules.length)}},deleteRule:function(sheet,index){if("deleteRule"in sheet){sheet.deleteRule(index)}else if("removeRule"in sheet){sheet.removeRule(index)}},parseSelectors:function(selectors,elementId){if(_.isString(selectors)){return selectors}var elementClass=elementId?".tailor-"+elementId:"";var prefix=".tailor-ui ";if(!selectors.length){return prefix+elementClass}selectors=selectors.map(function(selector){if(selector.indexOf("&")>-1){selector=selector.replace("&",elementClass)}else{var firstCharacter=selector.charAt(0);if(":"==firstCharacter||"::"==firstCharacter){selector=elementClass+selector; }else{selector=elementClass+" "+selector}}return prefix+selector});return selectors.join(",")},parseDeclarations:function(declarations){if(_.isString(declarations)){return declarations}var declaration="";_.each(declarations,function(value,property){declaration+=property+":"+value+";"});return declaration}};module.exports=CSS},{}],62:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;i'};options.dots=true}$el.tailorSlideshow(options)});$(".is-lightbox-gallery").each(function(){var $el=$(this);if($el.hasClass("tailor-carousel")){$el.tailorLightbox({delegate:".slick-slide:not( .slick-cloned ) .is-lightbox-image"})}else{$el.tailorLightbox()}});$(".is-lightbox-image").tailorLightbox({delegate:false})}};window.Tailor.Components.Abstract=abstractComponent;window.Tailor.Components.Lightbox=require("./shared/components/ui/lightbox");window.Tailor.Components.Map=require("./shared/components/ui/map");window.Tailor.Components.Masonry=require("./shared/components/ui/masonry");window.Tailor.Components.Parallax=require("./shared/components/ui/parallax");window.Tailor.Components.Slideshow=require("./shared/components/ui/slideshow");window.Tailor.Components.Tabs=require("./shared/components/ui/tabs");window.Tailor.Components.Toggles=require("./shared/components/ui/toggles");require("./frontend/components/ui/carousel");$(document).ready(function(){window.Tailor.initElements()})},{"./frontend/components/ui/carousel":2,"./shared/components/ui/abstract":3,"./shared/components/ui/lightbox":4,"./shared/components/ui/map":5,"./shared/components/ui/masonry":6,"./shared/components/ui/parallax":7,"./shared/components/ui/slideshow":8,"./shared/components/ui/tabs":9,"./shared/components/ui/toggles":10,"./shared/utility/polyfills/classlist":11,"./shared/utility/polyfills/raf":12,"./shared/utility/polyfills/transitions":13}],2:[function(require,module,exports){var $=window.jQuery,Carousel;Carousel=function(el,options,callbacks){this.el=el;this.$el=$(el);this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.options=$.extend(this.defaults,options,this.$el.data());if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.callbacks=$.extend(this.callbacks,callbacks);this.initialize()};Carousel.prototype={defaults:{items:"> .tailor-carousel__item",speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:false,adaptiveHeight:true,draggable:true,infinite:false,prevArrow:'',nextArrow:''},callbacks:{onInitialize:function(){},onDestroy:function(){}},initialize:function(){this.$items=this.$wrap.find(this.options.items);this.slick();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},slick:function(){this.$wrap.slick(this.options)},unSlick:function(){this.$wrap.slick("unslick")},destroy:function(e){this.unSlick();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}}};$.fn.tailorCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorCarousel");if(!instance){$.data(this,"tailorCarousel",new Carousel(this,options,callbacks))}})}},{}],3:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],4:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],5:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],6:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],7:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],9:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],10:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},initialize:function(){this.$el.accordion()}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],11:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;i'};options.dots=true}$el.tailorSlideshow(options)});$(".is-lightbox-gallery").each(function(){var $el=$(this);if($el.hasClass("tailor-carousel")){$el.tailorLightbox({delegate:".slick-slide:not( .slick-cloned ) .is-lightbox-image"})}else{$el.tailorLightbox()}});$(".is-lightbox-image").tailorLightbox({delegate:false})}};window.Tailor.Components.Abstract=abstractComponent;window.Tailor.Components.Lightbox=require("./shared/components/ui/lightbox");window.Tailor.Components.Map=require("./shared/components/ui/map");window.Tailor.Components.Masonry=require("./shared/components/ui/masonry");window.Tailor.Components.Parallax=require("./shared/components/ui/parallax");window.Tailor.Components.Slideshow=require("./shared/components/ui/slideshow");window.Tailor.Components.Tabs=require("./shared/components/ui/tabs");window.Tailor.Components.Toggles=require("./shared/components/ui/toggles");require("./frontend/components/ui/carousel");$(document).ready(function(){window.Tailor.initElements()})},{"./frontend/components/ui/carousel":2,"./shared/components/ui/abstract":3,"./shared/components/ui/lightbox":4,"./shared/components/ui/map":5,"./shared/components/ui/masonry":6,"./shared/components/ui/parallax":7,"./shared/components/ui/slideshow":8,"./shared/components/ui/tabs":9,"./shared/components/ui/toggles":10,"./shared/utility/polyfills/classlist":11,"./shared/utility/polyfills/raf":12,"./shared/utility/polyfills/transitions":13}],2:[function(require,module,exports){var $=window.jQuery,Carousel;Carousel=function(el,options,callbacks){this.el=el;this.$el=$(el);this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.options=$.extend(this.defaults,options,this.$el.data());if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.callbacks=$.extend(this.callbacks,callbacks);this.initialize()};Carousel.prototype={defaults:{items:"> .tailor-carousel__item",speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:false,adaptiveHeight:true,draggable:true,infinite:false,prevArrow:'',nextArrow:''},callbacks:{onInitialize:function(){},onDestroy:function(){}},initialize:function(){this.$items=this.$wrap.find(this.options.items);this.slick();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},slick:function(){this.$wrap.slick(this.options)},unSlick:function(){this.$wrap.slick("unslick")},destroy:function(e){this.unSlick();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}}};$.fn.tailorCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorCarousel");if(!instance){$.data(this,"tailorCarousel",new Carousel(this,options,callbacks))}})}},{}],3:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],4:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],5:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],6:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],7:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],9:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],10:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},initialize:function(){this.$el.accordion({header:".tailor-toggle h3"})}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],11:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;i Date: Fri, 10 Mar 2017 15:02:21 -0600 Subject: [PATCH 5/8] Added script from stackoverflow to implement "accordion" button behavior --- assets/js/dist/canvas.js | 51 ++++++++++++++++++- assets/js/dist/canvas.min.js | 4 +- assets/js/dist/frontend.js | 51 ++++++++++++++++++- assets/js/dist/frontend.min.js | 2 +- assets/js/src/shared/components/ui/toggles.js | 51 ++++++++++++++++++- 5 files changed, 153 insertions(+), 6 deletions(-) diff --git a/assets/js/dist/canvas.js b/assets/js/dist/canvas.js index 5c4ba5f..38d29bc 100644 --- a/assets/js/dist/canvas.js +++ b/assets/js/dist/canvas.js @@ -9418,9 +9418,58 @@ Toggles = Components.create( { }, initialize : function() { + var self = this; + var initial = self.options.initial - 1; + if (initial <= 0) { + initial = false; + } + + var accordionOverrideCallback = function(){}; + if (self.options.accordion){ + accordionOverrideCallback = self.allowMultiplePanesOpen; + } + this.$el.accordion({ - header : '.tailor-toggle h3' + header : '.tailor-toggle .tailor-toggle__title', + collapsible : true, + active : initial, + animate : self.options.speed, + beforeActivate: accordionOverrideCallback }); + }, + + /** + * Special JQueryUI default activation behavior to allow multiple + * toggles to be open at once. This is necessary to preserve the "accordion" + * feature. + * + * @see http://stackoverflow.com/questions/3479447/jquery-ui-accordion-that-keeps-multiple-sections-open + * @since TODO + */ + allowMultiplePanesOpen : function(event, ui) { + // The accordion believes a panel is being opened + if (ui.newHeader[0]) { + var currHeader = ui.newHeader; + var currContent = currHeader.next('.ui-accordion-content'); + // The accordion believes a panel is being closed + } else { + var currHeader = ui.oldHeader; + var currContent = currHeader.next('.ui-accordion-content'); + } + // Since we've changed the default behavior, this detects the actual status + var isPanelSelected = currHeader.attr('aria-selected') == 'true'; + + // Toggle the panel's header + currHeader.toggleClass('ui-corner-all',isPanelSelected).toggleClass('accordion-header-active ui-state-active ui-corner-top',!isPanelSelected).attr('aria-selected',((!isPanelSelected).toString())); + + // Toggle the panel's icon + currHeader.children('.ui-icon').toggleClass('ui-icon-triangle-1-e',isPanelSelected).toggleClass('ui-icon-triangle-1-s',!isPanelSelected); + + // Toggle the panel's content + currContent.toggleClass('accordion-content-active',!isPanelSelected) + if (isPanelSelected) { currContent.slideUp(); } else { currContent.slideDown(); } + + return false; // Cancels the default action } // /** diff --git a/assets/js/dist/canvas.min.js b/assets/js/dist/canvas.min.js index b01575d..e75a01d 100644 --- a/assets/js/dist/canvas.min.js +++ b/assets/js/dist/canvas.min.js @@ -1,5 +1,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o'+'
    '+"
    ")},onResize:function(e){var columnView=this;var device=app.channel.request("sidebar:device");var setting="desktop"==device?"width":"width_"+device;var model=columnView.model;var nextModel=model.collection.findWhere({parent:model.get("parent"),order:model.get("order")+1});var atts=model.get("atts");var nextAtts=nextModel.get("atts");var width=parseFloat(atts[setting]||atts.width);var nextWidth=parseFloat(nextAtts[setting]||nextAtts.width);var columnsWidth=width+nextWidth;var column=columnView.el.getBoundingClientRect();var $first=$(''+width+"%");var $second=$(''+nextWidth+"%");$first.prependTo(columnView.$el);$second.prependTo(columnView.$el.next());function onResize(e){document.body.classList.add("is-resizing");document.body.style.cursor="col-resize";var columnWidth=Math.min(columnsWidth-10,Math.max(10,Math.round(parseFloat((e.clientX-column.left)/column.width*width)*10)/10));var nextColumnWidth=Math.round(parseFloat(columnsWidth-columnWidth)*10)/10;columnWidth+="%";nextColumnWidth+="%";$first.html(columnWidth);$second.html(nextColumnWidth);var atts=_.clone(model.get("atts"));var nextAtts=_.clone(nextModel.get("atts"));atts[setting]=columnWidth;nextAtts[setting]=nextColumnWidth;model.set("atts",atts,{silent:true});nextModel.set("atts",nextAtts,{silent:true});model.trigger("change:width",model,atts);nextModel.trigger("change:width",nextModel,nextAtts)}function onResizeEnd(){document.removeEventListener("mousemove",onResize,false);document.removeEventListener("mouseup",onResizeEnd,false);document.body.classList.remove("is-resizing");document.body.style.cursor="default";$first.remove();$second.remove();var atts=model.get("atts");if(width!=atts[setting]){app.channel.trigger("element:resize",model)}}document.addEventListener("mousemove",onResize,false);document.addEventListener("mouseup",onResizeEnd,false);app.channel.trigger("canvas:reset");return false},onChangeWidth:function(model,atts){this.updateCSS(model.get("id"),atts);this.triggerAll("element:refresh",this)},updateCSS:function(elementId,atts){var ruleSet={};var width=atts["width"];var tabletWidth=atts["width_tablet"]||atts["width"];var mobileWidth=atts["width_mobile"]||atts["width"];ruleSet["desktop"]={};ruleSet["desktop"][elementId]=[{selectors:[],declarations:{width:width},setting:"width"}];ruleSet["tablet"]={};ruleSet["tablet"][elementId]=[{selectors:[".mobile-columns &",".tablet-columns &"],declarations:{width:tabletWidth},setting:"width_tablet"}];ruleSet["mobile"]={};ruleSet["mobile"][elementId]=[{selectors:[".mobile-columns &"],declarations:{width:mobileWidth},setting:"width_mobile"}];cssModule.deleteRules(elementId,"width");cssModule.deleteRules(elementId,"width_tablet");cssModule.deleteRules(elementId,"width_mobile");cssModule.addRules(ruleSet)}});module.exports=ColumnView},{"./../element-container":17}],10:[function(require,module,exports){var ContainerView=require("./../element-container"),TabView;TabView=ContainerView.extend({onRenderTemplate:function(){this.el.draggable=false;this.el.id=this.model.cid}});module.exports=TabView},{"./../element-container":17}],11:[function(require,module,exports){var ContainerView=require("./../element-container"),CarouselNavigationView=require("./navigation/carousel-navigation"),CarouselView;CarouselView=ContainerView.extend({onBeforeRenderTemplate:function(){if(this.navigation){this.navigation.triggerMethod("destroy")}},onRenderTemplate:function(){this.navigation=new CarouselNavigationView({model:this.model,collection:this.collection,sort:false});this.$el.append(this.navigation.render().el)},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this);this.navigation.triggerMethod("destroy")}});module.exports=CarouselView},{"./../element-container":17,"./navigation/carousel-navigation":13}],12:[function(require,module,exports){module.exports=Marionette.ItemView.extend({tagName:"li",attributes:function(){return{"data-id":this.model.cid}},getTemplate:function(){return _.template('')}})},{}],13:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({tagName:"ul",className:"slick-dots",childView:require("./carousel-navigation-item"),events:{dragstart:"onDragStart"},onDragStart:function(e){app.channel.trigger("canvas:reset");e.stopPropagation()},onRender:function(){var view=this;this.sortable=new Sortable(view.el,{draggable:"li",animation:150,onUpdate:function(e){var cid=e.item.getAttribute("data-id");view.$el.trigger("before:navigation:reorder",[cid,e.newIndex,e.oldIndex]);view.$el.trigger("navigation:reorder",[cid,e.newIndex,e.oldIndex]);app.channel.trigger("navigation:reorder",view.model)}})},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return child.get("parent")===this.model.get("id")},onBeforeDestroy:function(){this.sortable.destroy()}})},{"./carousel-navigation-item":12}],14:[function(require,module,exports){module.exports=Marionette.ItemView.extend({tagName:"li",className:function(){return"tailor-tabs__navigation-item tailor-"+this.model.get("id")},modelEvents:{"change:atts":"onChangeAttributes"},attributes:function(){return{"data-id":this.model.cid}},getTemplate:function(){return _.template('<%= title || "Tab" %>')},serializeData:function(){var data=Marionette.ItemView.prototype.serializeData.apply(this,arguments);var atts=this.model.get("atts");data.title=atts.title;return data},onChangeAttributes:function(model,atts){this.el.innerHTML=atts.title||"Tab"}})},{}],15:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({childView:require("./tabs-navigation-item"),events:{dragstart:"onDragStart"},onDragStart:function(e){app.channel.trigger("canvas:reset");e.stopPropagation()},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return child.get("parent")===this.model.get("id")},onRender:function(){var view=this;this.sortable=new Sortable(view.el,{draggable:"li",animation:150,onUpdate:function(e){var cid=e.item.getAttribute("data-id");view.$el.trigger("before:navigation:reorder",[cid,e.newIndex,e.oldIndex]);view.$el.trigger("navigation:reorder",[cid,e.newIndex,e.oldIndex]);app.channel.trigger("navigation:reorder",view.model)}})},onBeforeDestroy:function(){this.sortable.destroy()}})},{"./tabs-navigation-item":14}],16:[function(require,module,exports){var ContainerView=require("./../element-container"),TabsNavigationView=require("./navigation/tabs-navigation"),TabsView;TabsView=ContainerView.extend({ui:{navigation:".tailor-tabs__navigation"},onBeforeRenderTemplate:function(){if(this.navigation){this.navigation.triggerMethod("destroy")}},onRenderTemplate:function(){this.navigation=new TabsNavigationView({el:this.ui.navigation,model:this.model,collection:this.collection,sort:false});this.navigation.render()},childRefreshed:function(childView){childView.el.id=childView.model.cid;childView.el.classList.add("is-active");this.triggerAll("element:child:refresh",childView)},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this);this.navigation.triggerMethod("destroy")}});module.exports=TabsView},{"./../element-container":17,"./navigation/tabs-navigation":15}],17:[function(require,module,exports){var CompositeView=Marionette.CompositeView.extend({behaviors:{Container:{},Draggable:{},Droppable:{},Editable:{},Movable:{}},modelEvents:{"change:atts":"onChangeAttributes","change:order":"onChangeOrder","change:parent":"onChangeParent","change:setting":"onChangeSetting"},childEvents:{"before:element:ready":"beforeChildElementReady","element:ready":"childElementReady","before:element:refresh":"beforeChildElementRefreshed","element:refresh":"childElementRefreshed","before:element:jsRefresh":"beforeChildElementJSRefreshed","element:jsRefresh":"childElementJSRefreshed","element:change:parent":"childElementChangeParent","element:change:order":"childElementChangeOrder","before:element:destroy":"beforeChildElementDestroyed","element:destroy":"childElementDestroyed"},events:{"before:element:ready":"stopEventPropagation","element:ready":"stopEventPropagation","before:element:refresh":"stopEventPropagation","element:refresh":"stopEventPropagation","before:element:copy":"stopEventPropagation","element:copy":"stopEventPropagation","element:child:change:parent":"onDescendantChangeParent","element:child:change:order":"onDescendantChangeOrder","before:element:destroy":"stopEventPropagation","element:destroy":"stopEventPropagation","element:child:add":"onDescendantAdded","element:child:remove":"onDescendantRemoved","before:element:child:ready":"onBeforeDescendantReady","element:child:ready":"onDescendantReady","before:element:child:refresh":"onBeforeDescendantRefreshed","element:child:refresh":"onDescendantRefreshed","before:element:child:jsRefresh":"onBeforeDescendantJSRefreshed","element:child:jsRefresh":"onDescendantJSRefreshed","before:element:child:destroy":"onBeforeDescendantDestroyed","element:child:destroy":"onDescendantDestroyed","before:navigation:reorder":"stopEventPropagation","navigation:reorder":"onReorder"},onReorder:function(e,cid,index,oldIndex){var view=this.children.findByModelCid(cid);var otherView=this.children.find(function(childView){return childView.model.get("order")==index});if(oldIndex-index<0){view.$el.insertAfter(otherView.$el)}else{view.$el.insertBefore(otherView.$el)}this.children.each(function(childView){var childIndex=childView.$el.index();childView._index=childIndex;childView.model.set("order",childIndex)});view.model.collection.sort();e.stopPropagation()},onChangeAttributes:_.debounce(function(model,atts){model=this.model.toJSON();model.atts=atts?atts:{};var view=this;view.el.classList.add("is-rendering");window.ajax.send("tailor_render",{data:{model:JSON.stringify(model),nonce:window._nonces.render},success:function(response){view.updateTemplate(response.html);var id=view.model.get("id");app.channel.trigger("css:update",id,response.css)},error:function(response){view.updateTemplate('

    The template for '+view.cid+" could not be refreshed

    ");console.log(response)},complete:function(){var isEditing=view.$el.hasClass("is-editing");var isSelected=view.$el.hasClass("is-selected");view.$el.removeClass("is-rendering");view.triggerAll("before:element:refresh",view,model.atts);view.renderTemplate();view.triggerAll("element:refresh",view,model.atts);if(isEditing){view.$el.addClass("is-editing")}if(isSelected){view.$el.addClass("is-selected")}}})},250),onChangeOrder:function(){this.triggerAll("element:change:order",this)},onChangeParent:function(){this.triggerAll("element:change:parent",this)},onChangeSetting:function(setting,refresh){if(refresh){this.triggerAll("before:element:jsRefresh",this,this.model.get("atts"));app.channel.trigger("element:setting:change",setting,this);this.triggerAll("element:jsRefresh",this,this.model.get("atts"))}},initialize:function(){this._isReady=false;this._isBeingDestroyed=false;this.options.childViewContainer=this.model.get("child_container")||null;this.addEventListeners()},addEventListeners:function(){this.listenTo(app.channel,"before:elements:restore",this.onBeforeDestroy)},getChildView:function(child){return Tailor.lookup(child.get("tag"),child.get("type"),"Views")},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return child.get("parent")===this.model.get("id")},attachElContent:function(html){var $el=jQuery(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("draggable",true);this.el.setAttribute("tailor-label",this.model.get("label"));this.el.classList.add("tailor-"+this.model.cid);this.el.title=_l10n.edit_element;return this},getTemplateId:function(){return"tmpl-tailor-"+this.model.get("id")},getTemplate:function(){var el=document.querySelector("#"+this.getTemplateId());var template;if(el){template=_.template(el.innerHTML);el.parentElement.removeChild(el)}else{el=document.querySelector("#tmpl-tailor-"+this.model.get("tag")+"-default");template=_.template(el.innerHTML)}return template},updateTemplate:function(html){var templateId=this.getTemplateId();var el=document.querySelector("#"+templateId);if(!el){el=document.createElement("script");el.setAttribute("type","text/html");el.id=templateId;document.body.appendChild(el)}el.innerHTML=html},renderTemplate:function(){this._ensureViewIsIntact();var $childViewContainer=this.getChildViewContainer(this);var $children=$childViewContainer.contents().detach();this.resetChildViewContainer();this._renderTemplate();$childViewContainer=this.getChildViewContainer(this);$childViewContainer.append($children);return this},onBeforeRender:function(){this.triggerAll("before:element:ready",this)},onDomRefresh:function(){this.$el.find("a").attr({draggable:false,target:"_blank"});this.$el.find("img").attr({draggable:false})},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this)},onDestroy:function(){this.triggerAll("element:destroy",this)},beforeChildElementReady:function(childView){if(this._isReady&&this.children.contains(childView)){this.triggerAll("before:element:child:ready",childView)}},childElementReady:function(childView){if(this.children.contains(childView)){if(!this._isReady){var readyChildren=this.children.filter(function(childView){return childView._isReady}).length;if(this.children.length==readyChildren){this._isReady=true;this.triggerAll("element:ready",this)}}else{this.triggerAll("element:child:ready",childView)}}},beforeChildElementRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("before:element:child:refresh",childView)}},childElementRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:refresh",childView)}},beforeChildElementJSRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("before:element:child:jsRefresh",childView)}},childElementJSRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:jsRefresh",childView)}},childElementChangeOrder:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:change:order",childView)}},childElementChangeParent:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:change:parent",childView)}},beforeChildElementDestroyed:function(childView){if(!this._isBeingDestroyed){this.triggerAll("before:element:child:destroy",childView)}},childElementDestroyed:function(childView){if(!this._isBeingDestroyed){this.triggerAll("element:child:destroy",childView)}},onDescendantAdded:function(e,view){this.triggerAll("element:descendant:add",view);e.stopPropagation()},onDescendantRemoved:function(e,view){this.triggerAll("element:descendant:remove",view);e.stopPropagation()},onBeforeDescendantReady:function(e,view){this.triggerAll("before:element:descendant:ready",view);e.stopPropagation()},onDescendantReady:function(e,view){this.triggerAll("element:descendant:ready",view);e.stopPropagation()},onBeforeDescendantRefreshed:function(e,view){this.triggerAll("before:element:descendant:refresh",view);e.stopPropagation()},onDescendantRefreshed:function(e,view){this.triggerAll("element:descendant:refresh",view);e.stopPropagation()},onBeforeDescendantJSRefreshed:function(e,view){this.triggerAll("before:element:descendant:jsRefresh",view);e.stopPropagation()},onDescendantJSRefreshed:function(e,view){this.triggerAll("element:descendant:jsRefresh",view);e.stopPropagation()},onDescendantChangeOrder:function(e,view){this.triggerAll("element:descendant:change:order",view);e.stopPropagation()},onDescendantChangeParent:function(e,view){this.triggerAll("element:descendant:change:parent",view);e.stopPropagation()},onBeforeDescendantDestroyed:function(e,view){this.triggerAll("before:element:descendant:destroy",view);e.stopPropagation()},onDescendantDestroyed:function(e,view){this.triggerAll("element:descendant:destroy",view);e.stopPropagation()},stopEventPropagation:function(e){e.stopPropagation()},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}},_updateIndices:function(view,increment,index){if(increment){view._index=index;view.model._changing=false;view.model.set("order",index)}this.children.each(function(laterView){if(laterView._index>=view._index){laterView._index+=increment?1:-1; laterView.model.set("order",laterView._index)}},this)}});module.exports=CompositeView},{}],18:[function(require,module,exports){var $=window.jQuery,ElementView;ElementView=Marionette.ItemView.extend({className:"element",attributes:{draggable:true},behaviors:{Draggable:{},Droppable:{},Editable:{},Movable:{}},modelEvents:{"change:atts":"onChangeAttributes","change:parent":"onChangeParent","change:setting":"onChangeSetting"},initialize:function(){this._isReady=false;this._isBeingDestroyed=false;this.addEventListeners()},addEventListeners:function(){this.listenTo(app.channel,"before:elements:restore",this.onBeforeDestroy)},getTemplateId:function(){return"tmpl-tailor-"+this.model.get("id")},getTemplate:function(){var el=document.querySelector("#"+this.getTemplateId());var template;if(el){template=_.template(el.innerHTML);el.parentElement.removeChild(el)}else{el=document.querySelector("#tmpl-tailor-"+this.model.get("tag")+"-default");template=_.template(el.innerHTML)}return template},attachElContent:function(html){var $el=$(html);var el=$el[0];this.$el.replaceWith(el);this.setElement(el);this.el.setAttribute("draggable",true);this.el.setAttribute("tailor-label",this.model.get("label"));this.el.classList.add("tailor-"+this.model.id);this.el.title=_l10n.edit_element;return this},updateTemplate:function(html){var templateId=this.getTemplateId();var el=document.querySelector("#"+templateId);if(!el){el=document.createElement("script");el.setAttribute("type","text/html");el.id=templateId;document.body.appendChild(el)}el.innerHTML=html},onChangeAttributes:_.debounce(function(model,atts){var view=this;model=model.toJSON();if(atts){model.atts=atts}view.el.classList.add("is-rendering");window.ajax.send("tailor_render",{data:{model:JSON.stringify(model),nonce:window._nonces.render},success:function(response){view.updateTemplate(response.html);app.channel.trigger("css:update",view.model.get("id"),response.css)},error:function(response){view.updateTemplate('

    The template for '+view.cid+" could not be refreshed

    ");console.log(response)},complete:function(){var isEditing=view.$el.hasClass("is-editing");var isSelected=view.$el.hasClass("is-selected");view.$el.removeClass("is-rendering");view.triggerAll("before:element:refresh",view,model.atts);view.render();view.triggerAll("element:refresh",view,model.atts);if(isEditing){view.$el.addClass("is-editing")}if(isSelected){view.$el.addClass("is-selected")}}})},500),onChangeSetting:function(setting,refresh){if(refresh){this.triggerAll("before:element:jsRefresh",this,this.model.get("atts"));app.channel.trigger("element:setting:change",setting,this);this.triggerAll("element:jsRefresh",this,this.model.get("atts"))}},onChangeParent:function(){this.triggerAll("element:change:parent",this)},onBeforeRender:function(){this.triggerAll("before:element:ready",this)},onDomRefresh:function(){var view=this;this.$el.find("a").attr({draggable:false,target:"_blank"});this.$el.find("[onchange]").removeAttr("onchange");this.$el.find("img").attr({draggable:false});this.$el.imagesLoaded(function(){view._isReady=true;if(view.el.classList.contains("tailor-widget")&&0==view.$el.children().innerHeight()){var el=document.querySelector("#tmpl-tailor-element-empty");if(el){view.$el.html(el.innerHTML)}}view.triggerAll("element:ready",view)})},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this)},onDestroy:function(){this.triggerAll("element:destroy",this)},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}}});module.exports=ElementView},{}],19:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Carousel;Carousel=Components.create({slickActive:false,getDefaults:function(){return{items:".tailor-carousel__item",prevArrow:'',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:true,fade:false}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.slick()},slick:function(){var component=this;component.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){this.$wrap.slick("refresh")},unSlick:function(){this.$wrap.slick("unslick")},onMove:function(){if(this.slickActive){this.refreshSlick()}},onBeforeCopy:function(){if(this.slickActive){this.unSlick()}},onCopy:function(){if(!this.slickActive){this.slick()}},onBeforeRefresh:function(){if(this.slickActive){this.unSlick()}},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){if(this.slickActive){this.unSlick()}},onResize:function(){if(this.slickActive){this.refreshSlick()}}});$.fn.tailorSimpleCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSimpleCarousel");if(!instance){$.data(this,"tailorSimpleCarousel",new Carousel(this,options,callbacks))}})}},{}],20:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Carousel;Carousel=Components.create({getDefaults:function(){return{items:".tailor-carousel__item",prevArrow:'',nextArrow:'',adaptiveHeight:false,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,initialSlide:0,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:false,infinite:false}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.slickAt(0,this.addEventListeners)},slickAt:function(index,callback){this.querySelectors();var numberItems=this.$items.length;if(!numberItems){return}index=Math.min(index,numberItems-1);if(index "+component.options.items);component.$dots=component.$el.children(".slick-dots").find(" > li");component.$dots.on("click",function(e){var $dot=$(e.currentTarget);component.currentSlide=$dot.data("id");component.$wrap.slick("slickGoTo",$dot.index());e.preventDefault()});if(!component.currentSlide){var $activeSlide=component.$items.filter(function(){return this.classList.contains("slick-current")});component.currentSlide=$activeSlide.length?$activeSlide.id:component.$items[0].id}},updateDots:function(index){this.$dots.each(function(i,el){if(index==i){el.classList.add("slick-active")}else{el.classList.remove("slick-active")}});this.$dots.toggle(this.$dots.length/this.options.slidesToShow>1)},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onBeforeRefresh:function(){this.unSlick()},onRefresh:function(){this.refreshSlick()},onJSRefresh:function(){this.refreshSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onAddChild:function(){this.refreshSlick()},onRemoveChild:function(e,childView){childView.$el.detach();this.refreshSlick()},onBeforeReadyChild:function(e,childView){this.unSlick()},onReadyChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeReorderChild:function(){this.unSlick()},onReorderChild:function(e,cid,index,oldIndex){this.querySelectors();this.slickAt(index)},onBeforeRefreshChild:function(){this.unSlick()},onRefreshChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeJSRefreshChild:function(){this.unSlick()},onJSRefreshChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeDestroyChild:function(){this.unSlick()},onDestroyChild:function(e,childView){var index=childView.$el.index();childView.$el.remove();this.slickAt(index)},onAddDescendant:function(){this.refreshSlick()},onRemoveDescendant:function(){this.refreshSlick()},onReadyDescendant:function(){this.refreshSlick()},onRefreshDescendant:function(){this.refreshSlick()},onJSRefreshDescendant:function(){this.refreshSlick()},onDestroyDescendant:function(){this.refreshSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorCarousel");if(!instance){$.data(this,"tailorCarousel",new Carousel(this,options,callbacks))}})}},{}],21:[function(require,module,exports){var ElementCollection=Backbone.Collection.extend({comparator:"order",model:function(attrs,options){var Model=Tailor.lookup(attrs.tag,attrs.type,"Models");return new Model(attrs,options)},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"change:parent",this.onChangeParent);this.listenTo(this,"add",this.onAdd);this.listenTo(this,"destroy",this.onDestroy);this.listenTo(this,"container:collapse",this.onCollapse);this.listenTo(this,"reset",this.onReset)},getElementDefinitions:function(){return this.library||app.channel.request("sidebar:library")},applyDefaults:function(model){if(model instanceof Backbone.Model){model=model.toJSON()}var item=this.getElementDefinitions().findWhere({tag:model.tag});var defaults={label:item.get("label"),type:item.get("type")};var child=item.get("child");if(child){defaults.child=child}var childViewContainer=item.get("child_container");if(childViewContainer){defaults.child_container=childViewContainer}model.atts=model.atts||{};_.each(item.get("settings"),function(setting){if(!_.isEmpty(setting["value"])&&!model.atts.hasOwnProperty(setting["id"])){model.atts[setting["id"]]=setting["value"]}});return _.extend(model,defaults)},getParent:function(model){return this.findWhere({id:model.get("parent")})},getChildren:function(model){return this.where({parent:model.get("id")})},getSiblings:function(model){return this.where({parent:model.get("parent")})},hasSelectedParent:function(model){var selected=app.channel.request("canvas:element:selected");if(!selected||model===selected){return false}var parentId=model.get("parent");var parent=this.findWhere({id:parentId});while("undefined"!==typeof parent){if(selected===parent){return true}parentId=parent.get("parent");parent=this.get(parentId)}return false},onChangeParent:function(model){var parent=this.get(model.get("parent"));var previousParent=this.get(model.previous("parent"));this.sort({silent:true});this._checkParent(previousParent);if("tailor_column"===model.get("tag")){this._reBalanceColumns(parent);this._reBalanceColumns(previousParent)}},onAdd:function(model,collection,options){if("tailor_column"==model.get("tag")){this._reBalanceColumns(this.get(model.get("parent")))}},onDestroy:function(model){var parent=this.get(model.get("parent"));this._checkParent(parent);var children=this.where({parent:model.get("id")});if(children.length){_.each(children,function(child){child.trigger("destroy",child,this)},this)}if(parent&&"tailor_column"===model.get("tag")){this._reBalanceColumns(parent)}if(0===this.length){this.onEmpty()}},onReset:function(){if(0===this.length){this.onEmpty()}},onEmpty:function(){var section=this.createSection(0);this.create([{tag:"tailor_content",atts:{},parent:section.get("id"),order:0}])},onCollapse:function(model,children){var parentId=model.get("parent");_.each(children,function(child){child.set("parent",parentId)},this)},add:function(models,options){if(_.isArray(models)){_.each(models,this.applyDefaults.bind(this))}else{this.applyDefaults(models)}return this.set(models,_.extend({merge:false},options,{add:true,remove:false}))},create:function(models,options){options=options||{};return this.add(models,options)},createSection:function(order){return _.first(this.create([{tag:"tailor_section",order:order}],{at:order}))},createRow:function(parentId,order){var row=_.first(this.create([{tag:"tailor_row",parent:parentId,order:order}],{}));return this.create([{tag:"tailor_column",atts:{width:"50%"},parent:row.get("id"),order:0},{tag:"tailor_column",atts:{width:"50%"},parent:row.get("id"),order:1}])},createColumn:function(parentId,order){return _.first(this.create([{tag:"tailor_column",parent:parentId,order:order}]))},createContainer:function(model,parentId,order,descendants){var tag=model.get("tag");var container=_.first(this.create([{tag:tag,parent:parentId,order:order}],{at:order,silent:true}));var childTag=model.get("child");var children=this.create([{tag:childTag,parent:container.get("id"),order:0},{tag:childTag,parent:container.get("id"),order:1}],{silent:true});if(descendants){_.first(descendants).set("parent",_.first(children).get("id"),{silent:true});_.last(descendants).set("parent",_.last(children).get("id"),{silent:true})}this.trigger("add",container,this,{})},createWrapper:function(tag,parentId,order,child){var wrapper=_.first(this.create([{tag:tag,parent:parentId,order:order}],{silent:true}));if("undefined"==typeof child){this.create([{tag:"tailor_content",parent:wrapper.get("id"),order:0}],{silent:true})}this.trigger("add",wrapper,this,{});if("undefined"!=typeof child){this.insertChild(child,wrapper)}return wrapper},createChild:function(model){var child=_.first(this.create([{tag:model.get("child"),parent:model.get("id"),order:this.getChildren(model).length}],{silent:true}));this.create([{tag:"tailor_content",parent:child.get("id"),order:0}],{silent:true});this.trigger("add",child,this,{});return child},insertChild:function(child,parent){if(!child){return}if(child.get("parent")!==parent.get("id")){child.trigger("remove:child")}parent.trigger("insert",child);child.trigger("add:child");child.set("parent",parent.get("id"))},_reBalanceColumns:function(model){var children=this.where({parent:model.get("id")});var numberChildren=children.length;_.each(children,function(child){var atts=_.clone(child.get("atts"));atts["width"]=Math.round(parseFloat(1/numberChildren)*1e3)/10+"%";delete atts["width_tablet"];delete atts["width_mobile"];child.set("atts",atts,{silent:true});child.trigger("change:width",child,atts)},this)},_checkParent:function(model){if(!model){return}if("container"==model.get("type")){this._checkCollapsibleContainer(model)}this._checkChildren(model)},_checkChildren:function(model){var children=this.where({parent:model.get("id")});if(0===children.length){model.trigger("destroy",model)}},_checkCollapsibleContainer:function(model){var childTag=this.getElementDefinitions().findWhere({tag:model.get("tag")}).get("child");var containerId=model.get("id");var children=this.filter(function(element){return containerId===element.get("parent")&&childTag===element.get("tag")});if(0===children.length){model.trigger("container:collapse",model,this.where({parent:containerId}))}else if(1===children.length){var child=_.first(children);if("tailor_row"===model.get("tag")){child.trigger("container:collapse",child,this.where({parent:child.get("id")}))}}}});module.exports=ElementCollection},{}],22:[function(require,module,exports){var ChildModel=require("./../element-child"),ColumnModel;ColumnModel=ChildModel.extend({validTarget:function(that,region){if(_.contains(["tailor_section","tailor_row"],that.get("tag"))||!_.contains(["left","right"],region)){return false}if("child"==that.get("type")&&that.get("tag")!=this.get("tag")){return false}var siblings=this.collection.getSiblings(this);return that.get("parent")==this.get("parent")||siblings.length<6}});module.exports=ColumnModel},{"./../element-child":28}],23:[function(require,module,exports){var ChildModel=require("./../element-child"),GridItemModel;GridItemModel=ChildModel.extend({validTarget:function(that,region){if("tailor_section"==that.get("tag")||_.contains(["top","bottom","center"],region)){return false}var parent=this.collection.getParent(this);if(parent.get("tag")==that.get("tag")){return false}return that.get("tag")==this.get("tag")}});module.exports=GridItemModel},{"./../element-child":28}],24:[function(require,module,exports){var ContainerModel=require("./../element-container"),CarouselModel;CarouselModel=ContainerModel.extend({createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();var $navigation=view.$el.find(".slick-dots").detach();this.appendTemplate(id,view);$childViewContainer.append($children);$navigation.insertAfter($childViewContainer);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=CarouselModel},{"./../element-container":30}],25:[function(require,module,exports){var ContainerModel=require("./../element-container"),RowModel;RowModel=ContainerModel.extend({validTarget:function(that,region){if("child"==that.get("type")||"tailor_section"==that.get("tag")||"center"==region){return false}return _.contains(["top","bottom"],region)&&"tailor_column"!=that.get("tag")}});module.exports=RowModel},{"./../element-container":30}],26:[function(require,module,exports){var ContainerModel=require("./../element-container"),TabsModel;TabsModel=ContainerModel.extend({createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();var $navigation=view.$el.find(".tailor-tabs__navigation");var $navigationItems=$navigation.children().detach();this.appendTemplate(id,view);$childViewContainer.append($children);$navigation.append($navigationItems);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=TabsModel},{"./../element-container":30}],27:[function(require,module,exports){var Model;Backbone.Model.prototype.set=_.wrap(Backbone.Model.prototype.set,function(oldSet,key,val,options){if(key==null)return this;var attrs;if(typeof key==="object"){attrs=key;options=val}else{(attrs={})[key]=val}options||(options={});var ret=oldSet.call(this,attrs,options);if(this._tracking){_.each(attrs,_.bind(function(val,key){if(_.isEqual(this._original[key],val)){delete this._unsaved[key]}else{this._unsaved[key]=val}},this))}return ret});Model=Backbone.Model.extend({_tracking:false,_original:{},_unsaved:{},defaults:function(){return{id:this.cid,tag:"",label:"",atts:{},parent:"",order:0,collection:"element"}},isTracking:function(){return this._tracking},startTracking:function(){this._tracking=true;this.resetTracking();return this},stopTracking:function(){this._tracking=false;this._original={};this._unsaved={};return this},resetTracking:function(){this._original=_.clone(this.attributes);this._unsaved={};return this},resetAttributes:function(){if(!this._tracking){return}this.attributes=this._original;this.resetTracking();this.trigger("change:atts",this,this.get("atts"));return this},toShortcode:function(){var tag=this.get("tag");var atts=this.get("atts");var content="";var shortcode="["+tag;_.each(atts,function(attr,id){if(attr){if("content"===id){content=attr}else{if(_.isNumber(id)){if(/\s/.test(attr)){shortcode+=' "'+attr+'"'}else{shortcode+=" "+attr}}else{shortcode+=" "+id+'="'+attr+'"'}}}},this);return shortcode+"]"+content+"[/"+tag+"]"},insertBefore:function(view){this.trigger("remove:child");this.trigger("insert:before",view);this.trigger("add:child");this.set("parent",view.model.get("parent"))},insertAfter:function(view){this.trigger("remove:child");this.trigger("insert:after",view);this.trigger("add:child");this.set("parent",view.model.get("parent"))},columnBefore:function(view){var model=view.model;var parent=model.get("parent");if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(parent,model.get("order")-1);this.collection.insertChild(this,column)}else{var columns=this.collection.createRow(parent,model.get("order"));this.collection.insertChild(this,_.first(columns));this.collection.insertChild(model,_.last(columns))}},columnAfter:function(view){var model=view.model;var parent=model.get("parent");if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(parent,model.get("order"));this.collection.insertChild(this,column)}else{var columns=this.collection.createRow(parent,model.get("order"));this.collection.insertChild(model,_.first(columns));this.collection.insertChild(this,_.last(columns))}},beforeCopyElement:function(view){var el=view.el;view.triggerAll("before:element:copy",view);el.classList.remove("is-dragging");el.classList.remove("is-hovering");el.classList.remove("is-selected");el.classList.remove("is-editing")},appendTemplate:function(id,view){var oldId=view.model.get("id");var template=document.createElement("script");template.setAttribute("type","text/html");template.id="tmpl-tailor-"+id;template.innerHTML=view.el.outerHTML.replace(oldId,id);document.body.appendChild(template)},afterCopyElement:function(id,view){var oldId=view.model.get("id");view.$el.trigger("element:copy",view);app.channel.trigger("css:copy",oldId,id)}});module.exports=Model},{}],28:[function(require,module,exports){var CompositeModel=require("./element-composite"),ChildModel;ChildModel=CompositeModel.extend({validTarget:function(that,region){if("tailor_section"==that.get("tag")||_.contains(["left","right","center"],region)){return false}var parent=this.collection.getParent(this);if(parent.get("tag")==that.get("tag")){return false}return that.get("tag")==this.get("tag")},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.insertBefore);this.listenTo(this,"element:move:right",this.insertAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyBefore);this.listenTo(this,"element:copy:right",this.copyAfter)}});module.exports=ChildModel},{"./element-composite":29}],29:[function(require,module,exports){var BaseModel=require("./element-base"),CompositeModel;CompositeModel=BaseModel.extend({cloneContainer:function(sourceView,parent,index){var collection=this.collection;var clone=sourceView.model.clone();clone.set("id",clone.cid);clone.set("parent",parent);clone.set("order",index);this.createTemplate(clone.cid,sourceView);var clonedChildren=this.cloneChildren(sourceView.children,clone,[]);collection.add(clonedChildren,{silent:true});collection.add(clone);sourceView.triggerMethod("element:refresh")},cloneChildren:function(childViews,parent,clones){if(childViews.length){childViews.each(function(childView){var clone=childView.model.clone();clone.set("id",clone.cid);clone.set("parent",parent.get("id"));clone.createTemplate(clone.cid,childView);clones.push(clone);if(childView.children){this.cloneChildren(childView.children,clone,clones)}},this)}return clones},copyBefore:function(targetView,sourceView){this.cloneContainer(sourceView,targetView.model.get("parent"),targetView.model.get("order")-1)},copyAfter:function(targetView,sourceView){this.cloneContainer(sourceView,targetView.model.get("parent"),targetView.model.get("order"))},copyColumnBefore:function(targetView,sourceView){var parent=targetView.model.get("parent");if("tailor_column"===targetView.model.get("tag")){var column=this.collection.createColumn(parent,targetView.model.get("order")-1);this.cloneContainer(sourceView,column.get("id"),0)}else{var columns=this.collection.createRow(parent,targetView.model.get("order"));this.collection.insertChild(targetView.model,_.last(columns));this.cloneContainer(sourceView,_.first(columns).get("id"),0)}},copyColumnAfter:function(targetView,sourceView){var parent=targetView.model.get("parent");if("tailor_column"===targetView.model.get("tag")){var column=this.collection.createColumn(parent,targetView.model.get("order"));this.cloneContainer(sourceView,column.get("id"),0)}else{var columns=this.collection.createRow(parent,targetView.model.get("order"));this.collection.insertChild(targetView.model,_.first(columns));this.cloneContainer(sourceView,_.last(columns).get("id"),0)}},createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();this.appendTemplate(id,view);$childViewContainer.append($children);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=CompositeModel},{"./element-base":27}],30:[function(require,module,exports){var CompositeModel=require("./element-composite"),ContainerModel;ContainerModel=CompositeModel.extend({validTarget:function(that,region){if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("center"==region){return"container"!=that.get("type")}if(_.contains(["wrapper","child"],parent.get("type"))){if(_.contains(["top","bottom"],region)){return _.contains(["tailor_section","tailor_column"],parent.get("tag"))||!_.contains(["container","wrapper","child"],that.get("type"))}return"tailor_section"==parent.get("tag")||!_.contains(["left","right"],region)}return"container"!=that.get("type")},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter)}});module.exports=ContainerModel},{"./element-composite":29}],31:[function(require,module,exports){var CompositeModel=require("./element-composite"),WrapperModel;WrapperModel=CompositeModel.extend({validTarget:function(that,region){if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))||"center"==region){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("child"==parent.get("type")&&"tailor_column"!=parent.get("tag")){return"container"!=that.get("type")&&!_.contains(["left","right"],region)}if(_.contains(["container","wrapper","child"],parent.get("type"))){return"tailor_section"==parent.get("tag")||!_.contains(["left","right"],region)}return true},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter);this.listenTo(this,"element:move:center",this.createChild);this.listenTo(this,"element:copy:center",this.copyChild)},createChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;this.createTemplate(sourceView.model.get("id"),sourceView);this.collection.createWrapper(childTag,id,numberChildren,sourceView.model)},copyChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;var wrapper=this.collection.createWrapper(childTag,id,numberChildren,false);this.cloneContainer(sourceView,wrapper.get("id"),0)}});module.exports=WrapperModel},{"./element-composite":29}],32:[function(require,module,exports){var BaseModel=require("./element-base"),ElementModel;ElementModel=BaseModel.extend({validTarget:function(that,region,threshold){if(threshold<20){return false}if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))||"center"==region){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("child"==parent.get("type")&&"tailor_column"!=parent.get("tag")){return"container"!=that.get("type")&&!_.contains(["left","right"],region)}if(_.contains(["wrapper","child"],parent.get("type"))){if(_.contains(["top","bottom"],region)){return _.contains(["tailor_section","tailor_column"],parent.get("tag"))||!_.contains(["container","wrapper","child"],that.get("type"))}return"tailor_section"==parent.get("tag")||_.contains(["left","right"],region)}return true},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter);this.listenTo(this,"element:move:center",this.createChild);this.listenTo(this,"element:copy:center",this.copyChild)},copyBefore:function(targetView,sourceView){var clone=sourceView.model.clone();var index=targetView.model.get("order")-1;clone.set("id",clone.cid);clone.set("parent",targetView.model.get("parent"));clone.set("order",index);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},copyAfter:function(targetView,sourceView){var clone=sourceView.model.clone();var index=targetView.model.get("order");clone.set("id",clone.cid);clone.set("parent",targetView.model.get("parent"));clone.set("order",index);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},copyColumnBefore:function(targetView,sourceView){var model=targetView.model;var clone=sourceView.model.clone();clone.set("id",clone.cid);this.createTemplate(clone.cid,sourceView);if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(model.get("parent"),model.get("order")-1);clone.set("parent",column.get("id"));this.collection.add(clone)}else{var columns=this.collection.createRow(model.get("parent"),model.get("order"));this.collection.insertChild(model,_.last(columns));clone.set("parent",_.first(columns).get("id"));this.collection.add(clone)}},copyColumnAfter:function(targetView,sourceView){var model=targetView.model;var clone=sourceView.model.clone(); clone.set("id",clone.cid);this.createTemplate(clone.cid,sourceView);if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(model.get("parent"),model.get("order"));clone.set("parent",column.get("id"));this.collection.add(clone)}else{var columns=this.collection.createRow(model.get("parent"),model.get("order"));this.collection.insertChild(model,_.first(columns));clone.set("parent",_.last(columns).get("id"));this.collection.add(clone)}},createChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;this.appendTemplate(sourceView.model.get("id"),sourceView);this.collection.createWrapper(childTag,id,numberChildren,sourceView.model)},copyChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;var wrapper=this.collection.createWrapper(childTag,id,numberChildren,false);var clone=sourceView.model.clone();clone.set("id",clone.cid);clone.set("parent",wrapper.get("id"));clone.set("order",0);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);this.appendTemplate(id,view);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=ElementModel},{"./element-base":27}],33:[function(require,module,exports){var WrapperModel=require("./../element-wrapper"),SectionModel;SectionModel=WrapperModel.extend({validTarget:function(that,region){return"tailor_section"==that.get("tag")&&!_.contains(["left","right","center"],region)}});module.exports=SectionModel},{"./../element-wrapper":31}],34:[function(require,module,exports){var CanvasRegion=Backbone.Marionette.Region.extend({initialize:function(){this.listenTo(app.channel,"canvas:dragstart",this.onDragStart);this.listenTo(app.channel,"canvas:dragend",this.onDragEnd)},onDragStart:function(view,region,options){this.el.classList.add("is-active")},onDragEnd:function(view,region,options){this.el.classList.remove("is-active")}});module.exports=CanvasRegion},{}],35:[function(require,module,exports){var $=Backbone.$,$win=$(window),$doc=$(document),CanvasCollectionView=require("./show/canvas-view"),CanvasModule;CanvasModule=Marionette.Module.extend({onStart:function(){this._model=null;this._isDragging=false;this.collection=app.channel.request("canvas:elements");this.addEventListeners();this.showCanvas();app.channel.trigger("module:canvas:ready",this)},addEventListeners:function(){this.listenTo(app.channel,"canvas:dragstart",this.onDragStart);this.listenTo(app.channel,"canvas:dragover",this.onDragOver);this.listenTo(app.channel,"canvas:dragend",this.onDragEnd);this.listenTo(app.channel,"canvas:drop",this.onDrop);$doc.on("click dragover",this.reset.bind(this));$win.on("resize",this.reset.bind(this))},showCanvas:function(){app.canvasRegion.show(new CanvasCollectionView({collection:this.collection}))},onDragStart:function(e,view){var collection=view.model.collection;if("function"===typeof collection.hasSelectedParent&&collection.hasSelectedParent(view.model)){return}this._view=view;this._model=view.model;this._isDragging=true;view.el.classList.add("is-dragging");if("element"==view.model.get("collection")){var testVar=window.DataTransfer||window.Clipboard;if("setDragImage"in testVar.prototype){var dragImage=document.createElement("img");dragImage.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";e.dataTransfer.setDragImage(dragImage,0,0)}}e.dataTransfer.effectAllowed="copyMove";e.dataTransfer.setData("Text",this._model.cid);e.stopPropagation()},onDragOver:function(e,view){if(!this._isDragging){return}if(e.pageY){var scrollY=window.scrollY||document.documentElement.scrollTop;if(e.pageY-scrollY<40){window.scrollTo(0,scrollY-20)}else if(scrollY+window.innerHeight-e.pageY<40){window.scrollTo(0,scrollY+20)}}var action="element"===this._model.get("collection")&&e.shiftKey?"copy":"move";if("move"===action&&view.model===this._model){this.reset();e.stopPropagation();return}var region=this._getDropRegion(e,view);if(!view.model.validTarget(this._model,region)){return}e.dataTransfer.dropEffect=action;app.channel.trigger("canvas:guide",view,region);e.preventDefault();e.stopPropagation()},onDrop:function(e,view){if(!this._isDragging){return}var model=this._model;var region=this._getDropRegion(e,view);if(!view.model.validTarget(model,region)){return}var action;if("element"===model.get("collection")){action=e.shiftKey?"copy":"move";if("move"===action&&view.model===model){return}}else{action="add"}model.trigger("element:"+action+":"+region,view,this._view);app.channel.trigger("element:"+action,model);this.collection.sort({silent:true});e.preventDefault();e.stopPropagation()},onDragEnd:function(e,view){if(!this._isDragging){return}this._isDragging=false;this._view.el.classList.remove("is-dragging");this.reset()},reset:function(){app.channel.trigger("canvas:reset")},_getPoint:function(e){if(e.targetTouches){return{x:e.targetTouches[0].clientX,y:e.targetTouches[0].clientY}}return{x:e.clientX,y:e.clientY}},_getDropRegion:function(e,view){var point=this._getPoint(e);var rect=view.el.getBoundingClientRect();var width=rect.width/2;var height=rect.height/2;var top=rect.top+(rect.height-height)/2;var left=rect.left+(rect.width-width)/2;if(left<=point.x&&point.x<=left+width&&top<=point.y&&point.y<=top+height){return"center"}else{var x=(point.x-(rect.left+width))/width;var y=(point.y-(rect.top+height))/height;if(Math.abs(x)>Math.abs(y)){return x>0?"right":"left"}return y>0?"bottom":"top"}}});module.exports=CanvasModule},{"./show/canvas-view":36}],36:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({behaviors:{Container:{}},getChildView:function(){return Tailor.lookup("tailor_section","wrapper","Views")},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return!child.get("parent")},_updateIndices:function(view,increment,index){if(increment){view._index=index;view.model._changing=false;view.model.set("order",index)}this.children.each(function(laterView){if(laterView._index>=view._index){laterView._index+=increment?1:-1;laterView.model.set("order",laterView._index)}},this)},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}}})},{}],37:[function(require,module,exports){var Stylesheet=require("./stylesheet"),CSSModule;CSSModule=Marionette.Module.extend({onStart:function(options){this.stylesheets=[];this.collection=app.channel.request("canvas:elements");this.createSheets(options.mediaQueries||{});this.addRules(options.cssRules||{});this.addEventListeners();app.channel.trigger("module:css:ready",this)},addEventListeners:function(){this.listenTo(app.channel,"css:add",this.addRules);this.listenTo(app.channel,"css:delete",this.deleteRules);this.listenTo(app.channel,"css:update",this.updateRules);this.listenTo(app.channel,"css:copy",this.copyRules);this.listenTo(app.channel,"css:clear",this.clearRules);this.listenTo(this.collection,"destroy",this.onDestroy)},createSheet:function(id,min,max){var media="only screen";if(min){media+=" and (min-width: "+min+")"}if(max){media+=" and (max-width: "+max+")"}return new Stylesheet(id,media)},createSheets:function(mediaQueries){_.each(mediaQueries,function(atts,id){if(!_.isEmpty(atts.min)){if(!_.isEmpty(atts.max)){this.stylesheets[id+"-up"]=this.createSheet(id+"-up",atts.min);this.stylesheets[id]=this.createSheet(id,atts.min,atts.max)}else{this.stylesheets[id]=this.createSheet(id,atts.min)}}else{if(!_.isEmpty(atts.max)){this.stylesheets[id]=this.createSheet(id,null,atts.max)}else{this.stylesheets[id]=this.createSheet(id)}}},this);app.channel.trigger("module:css:stylesheets:ready",this)},getSheet:function(id){if(this.stylesheets.hasOwnProperty(id)){return this.stylesheets[id]}return false},addRules:function(cssRules){for(var queryId in cssRules){if(cssRules.hasOwnProperty(queryId)){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].addRules(cssRules[queryId])}}}},clearRules:function(){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].clearRules()}}},copyRules:function(elementId,newElementId){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){var rules=this.stylesheets[queryId].getRules(elementId);if(rules.length){for(var rule in rules){if(rules.hasOwnProperty(rule)){rules[rule].selectors=rules[rule].selectors.replace(new RegExp(elementId,"g"),newElementId)}}var rulesSet={};rulesSet[queryId]={};rulesSet[queryId][newElementId]=rules;this.addRules(rulesSet)}}}},deleteRules:function(elementId,settingId){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].deleteRules(elementId,settingId)}}},updateRules:function(elementId,cssRules){this.deleteRules(elementId);this.addRules(cssRules)},onReset:function(){this.clearRules()},onDestroy:function(model){this.deleteRules(model.get("id"))}});module.exports=CSSModule},{"./stylesheet":38}],38:[function(require,module,exports){function Stylesheet(id,media){this.id=id;this.initialize(media)}Stylesheet.prototype={initialize:function(media){this.stylesheet=this.createStylesheet(media);this.sheet=this.stylesheet.sheet;this.lookup=[]},createStylesheet:function(media){var style=document.createElement("style");style.appendChild(document.createTextNode(""));media=media||"screen";style.setAttribute("media",media);style.setAttribute("id","tailor-"+this.id);document.head.appendChild(style);return style},addRules:function(ruleSet){for(var elementId in ruleSet){if(ruleSet.hasOwnProperty(elementId)){this.lookup=this.lookup||[];for(var i in ruleSet[elementId]){if(ruleSet[elementId].hasOwnProperty(i)){this.addRule(elementId,ruleSet[elementId][i])}}}}},addRule:function(elementId,rule){if(this.checkRule(rule)){var selectors=Tailor.CSS.parseSelectors(rule["selectors"],elementId);var declarations=Tailor.CSS.parseDeclarations(rule["declarations"]);if(!_.isEmpty(declarations)){var settingId=rule["setting"];Tailor.CSS.addRule(this.sheet,selectors,declarations,this.lookup.length);this.lookup.push({elementId:elementId,settingId:settingId})}}},checkRule:function(rule){return _.has(rule,"selectors")&&_.has(rule,"declarations")&&_.has(rule,"setting")},getRules:function(elementId){var rules=[];for(var i=0;i-1){rules.push({selectors:rule.selectorText,declarations:rule.style.cssText,setting:this.lookup[i]["settingId"]||""})}}}return rules},deleteRules:function(elementId,settingId){for(var i=0;i1){module.collection.add(parents,{at:index+1})}else{parents[0].parent=parent;parents[0].order=index;module.collection.add(parents)}app.channel.trigger("template:add",model)}canvas.classList.remove("is-loading")}})}};app.channel.on("template:load",api.loadTemplate);app.channel.trigger("module:templates:ready",this)}});module.exports=TemplateModule},{}],41:[function(require,module,exports){var SelectRegion=Backbone.Marionette.Region.extend({onShow:function(view,region,options){view._view.el.classList.add("is-selected")},onEmpty:function(view,region,options){view._view.el.classList.remove("is-selected")}});module.exports=SelectRegion},{}],42:[function(require,module,exports){var GuideView=Marionette.ItemView.extend({template:false,position:function(view,drop){var $el=view.$el;var offset=$el.offset();var parentOffset=this.$el.offsetParent().offset();this.el.style.visibility="visible";this.el.className="guide guide--"+drop+" guide--"+view.model.get("tag");this.el.style.left=offset.left-parentOffset.left+"px";this.el.style.top=offset.top-parentOffset.top+"px";this.el.style.width=$el.outerWidth()+"px";this.el.style.height=$el.outerHeight()+"px";this.el.style.opacity=1},reset:function(){this.el.style="";this.el.style.visibility="hidden";this.el.style.opacity=0}});module.exports=GuideView},{}],43:[function(require,module,exports){var SelectMenuItemView=Marionette.ItemView.extend({tagName:"div",className:"select__item",events:{click:"onClick"},getTemplate:function(){return _.template("<%= label %>")},onClick:function(e){if(0===this._index){this.triggerMethod("toggle")}else{this.model.trigger("select")}e.stopPropagation()}});module.exports=SelectMenuItemView},{}],44:[function(require,module,exports){var SelectMenuItemView=require("./select-menu-item"),SelectMenuView;SelectMenuView=Marionette.CompositeView.extend({className:"select",childView:SelectMenuItemView,childViewContainer:".select__menu",ui:{add:".js-add",edit:".js-edit",copy:".js-copy",delete:".js-delete"},events:{"click @ui.add":"addElement","click @ui.edit":"editElement","click @ui.copy":"copyElement","click @ui.delete":"deleteElement"},modelEvents:{destroy:"destroy"},childEvents:{toggle:"toggleMenu"},template:"#tmpl-tailor-tools-select",serializeData:function(){var data=Backbone.Marionette.CompositeView.prototype.serializeData.apply(this,arguments);data.type=this.model.get("type");data.siblings=this.collection.where({parent:this.model.get("parent")}).length;return data},initialize:function(options){this._view=options.view},_filteredSortedModels:function(){var models=[];var model=this.model;while("undefined"!==typeof model){models.push(model);model=this.collection.get(model.get("parent"))}return models},onDomRefresh:function(){var thisRect=this.el.parentNode.getBoundingClientRect();var thatRect=this._view.el.getBoundingClientRect();var style=getComputedStyle(this._view.el,null);var borderTop=parseInt(style.getPropertyValue("border-top-width"),10);var borderRight=parseInt(style.getPropertyValue("border-right-width"),10);var borderBottom=parseInt(style.getPropertyValue("border-bottom-width"),10);var borderLeft=parseInt(style.getPropertyValue("border-left-width"),10);var left=Math.round(parseFloat(thatRect.left))+borderLeft;var right=Math.min(window.innerWidth+1,Math.round(thatRect.right)-borderRight);var width=right-left;this.el.style.top=Math.round(parseFloat(thatRect.top-parseFloat(thisRect.top)))+borderTop+"px";this.el.style.left=left-thisRect.left+"px";this.el.style.width=width+"px";this.el.style.height=Math.round(parseFloat(thatRect.height))-borderTop-borderBottom+"px";var controls=this.el.querySelector(".select__controls");var menu=this.el.querySelector(".select__menu");if(menu&&controls){var menuRect=menu.getBoundingClientRect();var controlsRect=controls.getBoundingClientRect();if(menuRect.width+controlsRect.width>parseInt(this.el.style.width,10)){this.el.classList.add("is-minimal")}}},addElement:function(){var child=this.model.collection.createChild(this.model);child.set("collection","library",{silent:true});app.channel.trigger("element:add",child)},editElement:function(){app.channel.trigger("modal:open",this.model)},copyElement:function(){this.model.copyAfter(this._view,this._view);app.channel.trigger("element:copy",this.model)},deleteElement:function(){this.model.trigger("destroy",this.model);app.channel.trigger("element:delete",this.model)},toggleMenu:function(){this.$el.toggleClass("is-expanded")}});module.exports=SelectMenuView},{"./select-menu-item":43}],45:[function(require,module,exports){var GuideView=require("./show/guide"),SelectorView=require("./show/select-menu"),ToolsModule;ToolsModule=Marionette.Module.extend({onStart:function(){var guide=new GuideView({el:"#guide"}).render();var api={positionGuide:function(view,drop){guide.position(view,drop)},selectElement:function(view){app.selectRegion.show(new SelectorView({model:view.model,collection:app.channel.request("canvas:elements"),view:view}))},resetGuide:function(){guide.reset();app.selectRegion.empty()},getSelectedElement:function(){var select=app.selectRegion.currentView;return select?select.model:null}};this.listenTo(app.channel,"canvas:guide",api.positionGuide);this.listenTo(app.channel,"canvas:select",api.selectElement);this.listenTo(app.channel,"canvas:reset",api.resetGuide);this.listenTo(app.channel,"element:refresh:template",api.resetGuide);app.channel.reply("canvas:element:selected",api.getSelectedElement);app.channel.trigger("module:tools:ready",this)}});module.exports=ToolsModule},{"./show/guide":42,"./show/select-menu":44}],46:[function(require,module,exports){require("./preview/helpers");require("./preview/behaviors");require("./preview/css")},{"./preview/behaviors":47,"./preview/css":48,"./preview/helpers":49}],47:[function(require,module,exports){(function($,app,SettingAPI,ElementAPI){ElementAPI.onRender("tailor_carousel",function(atts,model){var carousel=this;var options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:false,fade:"1"==atts.fade&&"1"==atts.items_per_row,slidesToShow:parseInt(atts.items_per_row,10)||1,adaptiveHeight:true};carousel.$el.tailorCarousel(options)});ElementAPI.onRender("tailor_content",function(atts,model){if(this.$el.find(".is-lightbox-image").length>0){this.$el.tailorLightbox({disableOn:function(){return $el.hasClass("is-selected")}})}});ElementAPI.onRender("tailor_gallery",function(atts,model){var $el=this.$el;var options;if("carousel"==atts.layout){options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:"1"==atts.dots,fade:"1"==atts.fade&&"1"==atts.items_per_row,infinite:false,slidesToShow:parseInt(atts.items_per_row,10)||2};$el.tailorSimpleCarousel(options)}else if("slideshow"==atts.layout){options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:false,fade:true,items:".tailor-slideshow__slide",adaptiveHeight:true,draggable:false,speed:250};if("1"==atts.thumbnails){options.customPaging=function(slider,i){var thumb=$(slider.$slides[i]).data("thumb");return''};options.dots=true}$el.tailorSlideshow(options)}else if(atts.masonry){$el.tailorMasonry()}if(this.el.classList.contains("is-lightbox-gallery")){$el.tailorLightbox({disableOn:function(){return $el.hasClass("is-selected")}})}});ElementAPI.onRender("tailor_map",function(atts,model){this.$el.tailorGoogleMap()});ElementAPI.onRender("tailor_posts",function(atts,model){var $el=this.$el;var options;if("carousel"==atts.layout){options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:"1"==atts.dots,fade:"1"==atts.fade&&"1"==atts.items_per_row,infinite:false,slidesToShow:parseInt(atts.items_per_row,10)||2};this.$el.tailorSimpleCarousel(options)}else if(atts.masonry){$el.tailorMasonry()}});ElementAPI.onRender("tailor_section",function(atts,model){if(atts["background_image"]&&atts["parallax"]&&1==atts["parallax"]){this.$el.tailorParallax()}});ElementAPI.onRender("tailor_tabs",function(atts,model){this.$el.tailorTabs()});ElementAPI.onRender("tailor_toggles",function(atts,model){this.$el.tailorToggles()})})(window.jQuery,window.app,window.Tailor.Api.Setting,window.Tailor.Api.Element)},{}],48:[function(require,module,exports){var $=Backbone.$,$win=$(window);(function(window,app,SettingAPI){var cssRules=window._pageRules||[];var cssCollection={_tailor_section_width:"",_tailor_column_spacing:"",_tailor_element_spacing:"",_tailor_page_css:""};var stylesheet=document.createElement("style");stylesheet.appendChild(document.createTextNode(""));stylesheet.setAttribute("media","screen");stylesheet.setAttribute("id","tailor-settings");document.head.appendChild(stylesheet);function getStyleValues(string){var values;if(-1!=string.indexOf(",")){values=string.split(",")}else{values=string.split("-")}if(2==values.length){values=_.object(["top","bottom"],values)}else if(4==values.length){values=_.object(["top","right","bottom","left"],values)}else{values={}}return values}function getMediaQuery(string){var query="";_.each(["_tablet","_mobile"],function(target){if(string.substring(string.length-target.length)==target){query=target.substring(1)}});return query}function generateCSS(settingId,value){cssCollection[settingId]="";value=_.isString(value)?value.trim():value;if(!_.isEmpty(value)){_.each(cssRules[settingId],function(rule){var selectors=Tailor.CSS.parseSelectors(rule.selectors);var declarations=Tailor.CSS.parseDeclarations(rule.declarations).replace(/\{\{(.*?)\}\}/g,value);cssCollection[settingId]+="\n"+selectors+" {"+declarations+"}"})}}function updateStylesheet(){var value="";for(var settingId in cssCollection){if(cssCollection.hasOwnProperty(settingId)){value+=cssCollection[settingId]}}stylesheet.innerHTML=value;$win.trigger("resize")}app.channel.on("module:css:stylesheets:ready",function(cssModule){var settings=app.channel.request("sidebar:settings");if(settings&&settings.length){settings.each(function(setting){var id=setting.get("id");var value=setting.get("value");value=_.isString(value)?value.trim():value;if(!_.isEmpty(value)&&cssCollection.hasOwnProperty(id)){if(cssRules.hasOwnProperty(id)){generateCSS(id,value)}else{cssCollection[id]=value}}})}updateStylesheet();var ids=["_tailor_section_width","_tailor_column_spacing","_tailor_element_spacing"];_.each(ids,function(settingId){if(cssRules.hasOwnProperty(settingId)){SettingAPI.onChange("sidebar:"+settingId,function(to,from){generateCSS(settingId,to);updateStylesheet()})}});SettingAPI.onChange("sidebar:_tailor_page_css",function(to,from){cssCollection["_tailor_page_css"]=to;updateStylesheet()});SettingAPI.onChange("sidebar:_post_title",function(to,from){$("h1, h2, h1 a, h2 a").each(function(){if(from==this.textContent){this.textContent=to}})});window.Tailor.Settings.overrides={"*":{},tailor_button:{color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"color","tailorValidateColor"],background_color:[[".tailor-button__inner"],"background-color","tailorValidateColor"],background_color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"background-color","tailorValidateColor"],border_color:[[".tailor-button__inner"],"border-color","tailorValidateColor"],border_color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"border-color","tailorValidateColor"],padding:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],padding_tablet:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],padding_mobile:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],margin:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],margin_tablet:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],margin_mobile:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],border_width:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_radius:[[".tailor-button__inner"],"border-radius","tailorValidateUnit"],shadow:[[".tailor-button__inner"],"box-shadow"]},tailor_card:{border_color:[["",".tailor-card__header"],"border-color","tailorValidateColor"],padding:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"],padding_tablet:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"],padding_mobile:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"]},tailor_carousel:{border_color:[["",".slick-dots"],"border-color","tailorValidateColor"]},tailor_grid:{border_color:[[".tailor-grid__item"],"border-color","tailorValidateColor"],border_style:function(to,from,model){return[{selectors:["&.tailor-grid--bordered .tailor-grid__item"],declarations:{"border-style":tailorValidateString(to)+"!important"}}]},border_width:function(to,from,model){return[{selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]},border_width_tablet:function(to,from,model){return[{media:"tablet",selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]},border_width_mobile:function(to,from,model){return[{media:"mobile",selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]}},tailor_grid_item:{padding:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"],padding_tablet:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"],padding_mobile:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"]},tailor_tabs:{border_color:[[".tailor-tabs__navigation-item",".tailor-tab"],"border-color","tailorValidateColor"]},tailor_tab:{background_color:[["&.tailor-tabs__navigation-item","&.tailor-tab"],"background-color","tailorValidateColor"],padding:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],padding_tablet:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],padding_mobile:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],border_width:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],background_repeat:[["&.tailor-tab"],"background-repeat","tailorValidateString"],background_position:[["&.tailor-tab"],"background-position","tailorValidateString"],background_size:[["&.tailor-tab"],"background-size","tailorValidateString"],background_attachment:[["&.tailor-tab"],"background-attachment","tailorValidateString"]},tailor_toggle:{border_color:[[".tailor-toggle__title",".tailor-toggle__body"],"border-color","tailorValidateColor"],border_style:[[".tailor-toggle__title",".tailor-toggle__body"],"border-style","tailorValidateString"],border_radius:[[".tailor-toggle__title",".tailor-toggle__body"],"border-radius","tailorValidateUnit"]},tailor_section:{max_width:[[".tailor-section__content"],"max-width","tailorValidateUnit"],max_width_tablet:[[".tailor-section__content"],"max-width","tailorValidateUnit"],max_width_mobile:[[".tailor-section__content"],"max-width","tailorValidateUnit"],min_height:[[".tailor-section__content"],"min-height","tailorValidateUnit"],min_height_tablet:[[".tailor-section__content"],"min-height","tailorValidateUnit"],min_height_mobile:[[".tailor-section__content"],"min-height","tailorValidateUnit"]}};function getDefinition(tag,id,definition){if(window.Tailor.Settings.overrides["*"].hasOwnProperty(id)){return window.Tailor.Settings.overrides["*"][id]}if(window.Tailor.Settings.overrides.hasOwnProperty(tag)&&window.Tailor.Settings.overrides[tag].hasOwnProperty(id)){return window.Tailor.Settings.overrides[tag][id]}return definition}function registerCallbacks(definitions){_.each(definitions,function(definition,id){SettingAPI.onChange("element:"+id,function(to,from,model){definition=getDefinition(model.get("tag"),id,definition);if("function"==typeof definition){return definition.call(this,to,from,model)}if(""==to){return[]}var rule={media:getMediaQuery(id),selectors:definition[0],declarations:{}};if("function"==typeof window[definition[2]]){rule.declarations[definition[1]]=window[definition[2]](to)}else{rule.declarations[definition[1]]=to}return[rule]})})}_.each(["horizontal_alignment","horizontal_alignment_tablet","horizontal_alignment_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){var media=getMediaQuery(id);if(""!=media){media="-"+media}if(from){this.el.classList.remove("u-text-"+from+media)}this.el.classList.add("u-text-"+to+media);if("tailor_list_item"==model.get("tag")){var atts=model.get("atts");if(!_.isEmpty(atts["graphic_background_color"])||!_.isEmpty(atts["graphic_background_color_hover"])){return[{selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==to?"0":"1em","padding-right":"right"==to?"1em":"0"}}]}else{return[{selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}}]}}})});_.each(["vertical_alignment","vertical_alignment_tablet","vertical_alignment_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){var media=getMediaQuery(id);if(""!==media){media="-"+media}if(from){this.el.classList.remove("u-align-"+from+media)}this.el.classList.add("u-align-"+to+media)})});_.each(["size","size_tablet","size_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){if("tailor_button"==model.get("tag")){var media=getMediaQuery(id);if(""!=media){media="-"+media}if(from){this.el.classList.remove("tailor-button--"+from+media)}this.el.classList.add("tailor-button--"+to+media)}})});registerCallbacks({width:[[],"width","tailorValidateUnit"],width_tablet:[[],"width","tailorValidateUnit"],width_mobile:[[],"width","tailorValidateUnit"],max_width:[[],"max-width","tailorValidateUnit"],max_width_tablet:[[],"max-width","tailorValidateUnit"],max_width_mobile:[[],"max-width","tailorValidateUnit"],min_height:[[],"min-height","tailorValidateUnit"],min_height_tablet:[[],"min-height","tailorValidateUnit"],min_height_mobile:[[],"min-height","tailorValidateUnit"], -min_item_height:[[".tailor-grid__item"],"min-height","tailorValidateUnit"]});registerCallbacks({color:[[],"color","tailorValidateColor"],color_hover:[[":hover"],"color","tailorValidateColor"],link_color:[["a"],"color","tailorValidateColor"],link_color_hover:[["a:hover"],"color","tailorValidateColor"],heading_color:[["h1","h2","h3","h4","h5","h6"],"color","tailorValidateColor"],background_color:function(to,from,model){var atts=model.get("atts");if(atts["background_image"]){return false}var definition=getDefinition(model.get("tag"),"background_color",[[],"background-color","tailorValidateColor"]);if("function"==typeof definition){return definition.call(this,to,from,model)}var rule={selectors:definition[0],declarations:{}};if("function"==typeof window[definition[2]]){rule.declarations[definition[1]]=window[definition[2]](to)}else{rule.declarations[definition[1]]=to}return[rule]},background_color_hover:[[":hover"],"background-color","tailorValidateColor"],border_color:[[],"border-color","tailorValidateColor"],border_color_hover:[[":hover"],"border-color","tailorValidateColor"],graphic_color:function(to,from,model){var tag=model.get("tag");if("tailor_box"==tag){return[{selectors:[".tailor-box__graphic"],declarations:{color:tailorValidateColor(to)}}]}else if("tailor_list_item"==tag){return[{selectors:[".tailor-list__graphic"],declarations:{color:tailorValidateColor(to)}}]}},graphic_color_hover:function(to,from,model){var tag=model.get("tag");if("tailor_box"==tag){return[{selectors:[".tailor-box__graphic:hover"],declarations:{color:tailorValidateColor(to)}}]}else if("tailor_list_item"==tag){return[{selectors:[".tailor-list__graphic:hover"],declarations:{color:tailorValidateColor(to)}}]}},graphic_background_color:function(to,from,model){var tag=model.get("tag");var rules=[];if("tailor_box"==tag){if(to){rules.push({selectors:[".tailor-box__graphic"],declarations:{"margin-bottom":"1em","background-color":tailorValidateColor(to),"text-align":"center"}})}}else if("tailor_list_item"==tag){var atts=model.get("atts");var alignment=atts["horizontal_alignment"];if(to){rules.push({selectors:[".tailor-list__graphic"],declarations:{"background-color":tailorValidateColor(to),"text-align":"center"}});rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{if(!_.isEmpty(atts["graphic_background_color_hover"])){rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}})}}}return rules},graphic_background_color_hover:function(to,from,model){var tag=model.get("tag");var rules=[];if("tailor_box"==tag){if(to){rules.push({selectors:[".tailor-box__graphic"],declarations:{"margin-bottom":"1em","text-align":"center"}});rules.push({selectors:[".tailor-box__graphic:hover"],declarations:{"background-color":tailorValidateColor(to)}})}}else if("tailor_list_item"==tag){var atts=model.get("atts");var alignment=atts["horizontal_alignment"];if(to){rules.push({selectors:[".tailor-list__graphic"],declarations:{"text-align":"center"}});rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}});rules.push({selectors:[".tailor-list__graphic:hover"],declarations:{"background-color":tailorValidateColor(to)}})}else{if(!_.isEmpty(atts["graphic_background_color"])){rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}})}}}return rules},title_color:[[".tailor-toggle__title"],"color","tailorValidateColor"],title_background_color:[[".tailor-toggle__title"],"background-color","tailorValidateColor"],navigation_color:function(to,from,model){return[{selectors:[".slick-active button:before"],declarations:{"background-color":tailorValidateColor(to)}},{selectors:[".slick-arrow:not( .slick-disabled )"],declarations:{color:tailorValidateColor(to)}}]}});registerCallbacks({class:function(to,from,model){var classNames;if(!_.isEmpty(from)){classNames=from.trim().split(/\s+(?!$)/g);for(var i in classNames){if(classNames.hasOwnProperty(i)){this.el.classList.remove(classNames[i])}}}if(!_.isEmpty(to)){classNames=to.trim().split(/\s+(?!$)/g);for(var j in classNames){if(classNames.hasOwnProperty(j)){this.el.classList.add(classNames[j])}}}},border_style:[[],"border-style","tailorValidateString"],border_radius:[[],"border-radius","tailorValidateUnit"],background_repeat:[[],"background-repeat","tailorValidateString"],background_position:[[],"background-position","tailorValidateString"],background_size:[[],"background-size","tailorValidateString"],background_attachment:[[],"background-attachment","tailorValidateString"],shadow:function(to,from,model){var definition=getDefinition(model.get("tag"),"shadow",[[]]);if("function"==typeof definition){return definition.call(this,to,from,model)}if(1==to){return[{selectors:definition[0],declarations:{"box-shadow":"0 2px 6px rgba(0, 0, 0, 0.1)"}}]}return[]}});_.each({margin:[[],"margin-{0}","tailorValidateUnit"],margin_tablet:[[],"margin-{0}","tailorValidateUnit"],margin_mobile:[[],"margin-{0}","tailorValidateUnit"],padding:[[],"padding-{0}","tailorValidateUnit"],padding_tablet:[[],"padding-{0}","tailorValidateUnit"],padding_mobile:[[],"padding-{0}","tailorValidateUnit"],border_width:[[],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[[],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[[],"border-{0}-width","tailorValidateUnit"]},function(definition,id){SettingAPI.onChange("element:"+id,function(to,from,model){definition=getDefinition(model.get("tag"),id,definition);if("function"==typeof definition){return definition.call(this,to,from,model)}var rules=[];var rule={media:getMediaQuery(id),selectors:definition[0],declarations:{}};_.each(getStyleValues(to),function(value,position){if("function"==typeof window[definition[3]]){rule.declarations[definition[1].replace("{0}",position)]=window[definition[2]](value)}else{rule.declarations[definition[1].replace("{0}",position)]=value}});if(_.keys(rule.declarations).length>0){rules.push(rule)}return rules})})})})(window,window.app,window.Tailor.Api.Setting)},{}],49:[function(require,module,exports){window.tailorValidateString=function(string){return string.replace(/[0-9]/g,"")};window.tailorValidateNumber=function(string){string=string.replace(/[^0-9,.]+/i,"");return!_.isEmpty(string)?string:"0"};window.tailorValidateColor=function(color){if(/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(color)){return color}if(isRGBA(color)){return color}return""};function isRGBA(color){return/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d*(?:\.\d+)?)\)$/.test(color)}window.tailorValidateUnit=function(value){var sign="";if("-"==value.charAt(0)){sign="-";value=value.substring(1)}return sign+tailorValidateNumber(value)+getUnit(value)};function getUnit(string){var map=["px","%","in","cm","mm","pt","pc","em","rem","ex","vw","vh"];var matches=string.match(new RegExp(map.join("|")));if(matches){return matches[0]}return"px"}},{}],50:[function(require,module,exports){var $=window.jQuery,$win=$(window),app=window.app,cssModule,callbacks={sidebar:[],element:[]};function checkQuery(query){if(!query||!_.contains(_.keys(cssModule.stylesheets),query)){query="all"}return query}var onSidebarChange=function(setting){var settingId=setting.get("id");if(_.isEmpty(callbacks["sidebar"][settingId])){return}_.each(callbacks["sidebar"][settingId],function(callback){callback.apply(window,[setting.get("value"),setting.previous("value")])});$win.trigger("resize")};var onElementChange=function(setting,view){var elementId=view.model.get("id");var settingId=setting.get("id");if(!callbacks["element"].hasOwnProperty(settingId)||0==callbacks["element"][settingId].length){return}if(1==callbacks["element"][settingId].length){cssModule.deleteRules(elementId,settingId)}var ruleSets={};var rules;_.each(callbacks["element"][settingId],function(callback){if("function"==typeof callback){rules=callback.apply(view,[setting.get("value"),setting.previous("value"),view.model]);if(false===rules){view.model.trigger("change:atts",view.model,view.model.get("atts"))}else if(_.isArray(rules)&&rules.length>0){for(var rule in rules){if(rules.hasOwnProperty(rule)){if(!rules[rule].hasOwnProperty("selectors")||!rules[rule].hasOwnProperty("declarations")){continue}var query=checkQuery(rules[rule].media);ruleSets[query]=ruleSets[query]||{};ruleSets[query][elementId]=ruleSets[query][elementId]||[];if(_.keys(rules[rule].declarations).length>0){ruleSets[query][elementId].push({selectors:rules[rule].selectors,declarations:rules[rule].declarations,setting:rules[rule].setting||settingId})}}}cssModule.addRules(ruleSets)}}})};app.listenTo(app.channel,"sidebar:setting:change",onSidebarChange);app.listenTo(app.channel,"element:setting:change",onElementChange);app.channel.on("module:css:stylesheets:ready",function(module){cssModule=module});function registerCallback(type,id,callback){if("function"===typeof callback){callbacks[type][id]=callbacks[type][id]||[];callbacks[type][id].push(callback)}}module.exports={onChange:function(id,callback){var parts=id.split(":");if(parts.length>=2&&_.contains(["sidebar","element"],parts[0])){registerCallback(parts[0],parts[1],callback)}}}},{}],51:[function(require,module,exports){var DraggableBehaviors=Marionette.Behavior.extend({events:{dragstart:"onDragStart",dragend:"onDragEnd",drag:"onDrag"},onDragStart:function(e){app.channel.trigger("canvas:dragstart",e.originalEvent,this.view)},onDrag:function(e){app.channel.trigger("canvas:drag",e.originalEvent,this.view)},onDragEnd:function(e){app.channel.trigger("canvas:dragend",e.originalEvent,this.view)}});module.exports=DraggableBehaviors},{}],52:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],53:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],54:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],55:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],56:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],58:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],59:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},initialize:function(){this.$el.accordion({header:".tailor-toggle h3"})}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],60:[function(require,module,exports){var $=jQuery,Ajax;Ajax={url:window.ajaxurl,post:function(action,data){return ajax.send({data:_.isObject(action)?action:_.extend(data||{},{action:action})})},send:function(action,options){if(_.isObject(action)){options=action}else{options=options||{};options.data=_.extend(options.data||{},{action:action,tailor:1})}options=_.defaults(options||{},{type:"POST",url:ajax.url,context:this});return $.Deferred(function(deferred){if(options.success){deferred.done(options.success)}var onError=options.error?options.error:ajax.onError;deferred.fail(onError);delete options.success;delete options.error;$.ajax(options).done(function(response){if(response==="1"||response===1){response={success:true}}if(_.isObject(response)&&!_.isUndefined(response.success)){deferred[response.success?"resolveWith":"rejectWith"](this,[response.data])}else{deferred.rejectWith(this,[response])}}).fail(function(){deferred.rejectWith(this,arguments)})}).promise()},onError:function(response){if(!Tailor.Notify){console.error(response);return}if(response&&response.hasOwnProperty("message")){Tailor.Notify(response.message)}else if("0"==response){Tailor.Notify(window._l10n.expired)}else if("-1"==response){Tailor.Notify(window._l10n.invalid)}else{Tailor.Notify(window._l10n.error)}}};window.ajax=Ajax;module.exports=Ajax},{}],61:[function(require,module,exports){var CSS={addRule:function(sheet,selector,declaration,index){if("insertRule"in sheet){sheet.insertRule(selector+" {"+declaration+"}",sheet.cssRules.length)}else if("addRule"in sheet){sheet.addRule(selector,declaration,sheet.cssRules.length)}},deleteRule:function(sheet,index){if("deleteRule"in sheet){sheet.deleteRule(index)}else if("removeRule"in sheet){sheet.removeRule(index)}},parseSelectors:function(selectors,elementId){if(_.isString(selectors)){return selectors}var elementClass=elementId?".tailor-"+elementId:"";var prefix=".tailor-ui ";if(!selectors.length){return prefix+elementClass}selectors=selectors.map(function(selector){if(selector.indexOf("&")>-1){selector=selector.replace("&",elementClass)}else{var firstCharacter=selector.charAt(0);if(":"==firstCharacter||"::"==firstCharacter){selector=elementClass+selector; -}else{selector=elementClass+" "+selector}}return prefix+selector});return selectors.join(",")},parseDeclarations:function(declarations){if(_.isString(declarations)){return declarations}var declaration="";_.each(declarations,function(value,property){declaration+=property+":"+value+";"});return declaration}};module.exports=CSS},{}],62:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;i0){rules.push(rule)}return rules})})})})(window,window.app,window.Tailor.Api.Setting)},{}],49:[function(require,module,exports){window.tailorValidateString=function(string){return string.replace(/[0-9]/g,"")};window.tailorValidateNumber=function(string){string=string.replace(/[^0-9,.]+/i,"");return!_.isEmpty(string)?string:"0"};window.tailorValidateColor=function(color){if(/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(color)){return color}if(isRGBA(color)){return color}return""};function isRGBA(color){return/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d*(?:\.\d+)?)\)$/.test(color)}window.tailorValidateUnit=function(value){var sign="";if("-"==value.charAt(0)){sign="-";value=value.substring(1)}return sign+tailorValidateNumber(value)+getUnit(value)};function getUnit(string){var map=["px","%","in","cm","mm","pt","pc","em","rem","ex","vw","vh"];var matches=string.match(new RegExp(map.join("|")));if(matches){return matches[0]}return"px"}},{}],50:[function(require,module,exports){var $=window.jQuery,$win=$(window),app=window.app,cssModule,callbacks={sidebar:[],element:[]};function checkQuery(query){if(!query||!_.contains(_.keys(cssModule.stylesheets),query)){query="all"}return query}var onSidebarChange=function(setting){var settingId=setting.get("id");if(_.isEmpty(callbacks["sidebar"][settingId])){return}_.each(callbacks["sidebar"][settingId],function(callback){callback.apply(window,[setting.get("value"),setting.previous("value")])});$win.trigger("resize")};var onElementChange=function(setting,view){var elementId=view.model.get("id");var settingId=setting.get("id");if(!callbacks["element"].hasOwnProperty(settingId)||0==callbacks["element"][settingId].length){return}if(1==callbacks["element"][settingId].length){cssModule.deleteRules(elementId,settingId)}var ruleSets={};var rules;_.each(callbacks["element"][settingId],function(callback){if("function"==typeof callback){rules=callback.apply(view,[setting.get("value"),setting.previous("value"),view.model]);if(false===rules){view.model.trigger("change:atts",view.model,view.model.get("atts"))}else if(_.isArray(rules)&&rules.length>0){for(var rule in rules){if(rules.hasOwnProperty(rule)){if(!rules[rule].hasOwnProperty("selectors")||!rules[rule].hasOwnProperty("declarations")){continue}var query=checkQuery(rules[rule].media);ruleSets[query]=ruleSets[query]||{};ruleSets[query][elementId]=ruleSets[query][elementId]||[];if(_.keys(rules[rule].declarations).length>0){ruleSets[query][elementId].push({selectors:rules[rule].selectors,declarations:rules[rule].declarations,setting:rules[rule].setting||settingId})}}}cssModule.addRules(ruleSets)}}})};app.listenTo(app.channel,"sidebar:setting:change",onSidebarChange);app.listenTo(app.channel,"element:setting:change",onElementChange);app.channel.on("module:css:stylesheets:ready",function(module){cssModule=module});function registerCallback(type,id,callback){if("function"===typeof callback){callbacks[type][id]=callbacks[type][id]||[];callbacks[type][id].push(callback)}}module.exports={onChange:function(id,callback){var parts=id.split(":");if(parts.length>=2&&_.contains(["sidebar","element"],parts[0])){registerCallback(parts[0],parts[1],callback)}}}},{}],51:[function(require,module,exports){var DraggableBehaviors=Marionette.Behavior.extend({events:{dragstart:"onDragStart",dragend:"onDragEnd",drag:"onDrag"},onDragStart:function(e){app.channel.trigger("canvas:dragstart",e.originalEvent,this.view)},onDrag:function(e){app.channel.trigger("canvas:drag",e.originalEvent,this.view)},onDragEnd:function(e){app.channel.trigger("canvas:dragend",e.originalEvent,this.view)}});module.exports=DraggableBehaviors},{}],52:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],53:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],54:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],55:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],56:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],58:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],59:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},initialize:function(){var self=this;var initial=self.options.initial-1;if(initial<=0){initial=false}var accordionOverrideCallback=function(){};if(self.options.accordion){accordionOverrideCallback=self.allowMultiplePanesOpen}this.$el.accordion({header:".tailor-toggle .tailor-toggle__title",collapsible:true,active:initial,animate:self.options.speed,beforeActivate:accordionOverrideCallback})},allowMultiplePanesOpen:function(event,ui){if(ui.newHeader[0]){var currHeader=ui.newHeader;var currContent=currHeader.next(".ui-accordion-content")}else{var currHeader=ui.oldHeader;var currContent=currHeader.next(".ui-accordion-content")}var isPanelSelected=currHeader.attr("aria-selected")=="true";currHeader.toggleClass("ui-corner-all",isPanelSelected).toggleClass("accordion-header-active ui-state-active ui-corner-top",!isPanelSelected).attr("aria-selected",(!isPanelSelected).toString());currHeader.children(".ui-icon").toggleClass("ui-icon-triangle-1-e",isPanelSelected).toggleClass("ui-icon-triangle-1-s",!isPanelSelected);currContent.toggleClass("accordion-content-active",!isPanelSelected);if(isPanelSelected){currContent.slideUp()}else{currContent.slideDown()}return false}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],60:[function(require,module,exports){var $=jQuery,Ajax;Ajax={url:window.ajaxurl,post:function(action,data){return ajax.send({data:_.isObject(action)?action:_.extend(data||{},{action:action})})},send:function(action,options){if(_.isObject(action)){options=action}else{options=options||{};options.data=_.extend(options.data||{},{action:action,tailor:1})}options=_.defaults(options||{},{type:"POST",url:ajax.url,context:this});return $.Deferred(function(deferred){if(options.success){deferred.done(options.success)}var onError=options.error?options.error:ajax.onError;deferred.fail(onError);delete options.success;delete options.error;$.ajax(options).done(function(response){if(response==="1"||response===1){response={success:true}}if(_.isObject(response)&&!_.isUndefined(response.success)){deferred[response.success?"resolveWith":"rejectWith"](this,[response.data])}else{deferred.rejectWith(this,[response])}}).fail(function(){deferred.rejectWith(this,arguments)})}).promise()},onError:function(response){if(!Tailor.Notify){console.error(response);return}if(response&&response.hasOwnProperty("message")){ +Tailor.Notify(response.message)}else if("0"==response){Tailor.Notify(window._l10n.expired)}else if("-1"==response){Tailor.Notify(window._l10n.invalid)}else{Tailor.Notify(window._l10n.error)}}};window.ajax=Ajax;module.exports=Ajax},{}],61:[function(require,module,exports){var CSS={addRule:function(sheet,selector,declaration,index){if("insertRule"in sheet){sheet.insertRule(selector+" {"+declaration+"}",sheet.cssRules.length)}else if("addRule"in sheet){sheet.addRule(selector,declaration,sheet.cssRules.length)}},deleteRule:function(sheet,index){if("deleteRule"in sheet){sheet.deleteRule(index)}else if("removeRule"in sheet){sheet.removeRule(index)}},parseSelectors:function(selectors,elementId){if(_.isString(selectors)){return selectors}var elementClass=elementId?".tailor-"+elementId:"";var prefix=".tailor-ui ";if(!selectors.length){return prefix+elementClass}selectors=selectors.map(function(selector){if(selector.indexOf("&")>-1){selector=selector.replace("&",elementClass)}else{var firstCharacter=selector.charAt(0);if(":"==firstCharacter||"::"==firstCharacter){selector=elementClass+selector}else{selector=elementClass+" "+selector}}return prefix+selector});return selectors.join(",")},parseDeclarations:function(declarations){if(_.isString(declarations)){return declarations}var declaration="";_.each(declarations,function(value,property){declaration+=property+":"+value+";"});return declaration}};module.exports=CSS},{}],62:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;i'};options.dots=true}$el.tailorSlideshow(options)});$(".is-lightbox-gallery").each(function(){var $el=$(this);if($el.hasClass("tailor-carousel")){$el.tailorLightbox({delegate:".slick-slide:not( .slick-cloned ) .is-lightbox-image"})}else{$el.tailorLightbox()}});$(".is-lightbox-image").tailorLightbox({delegate:false})}};window.Tailor.Components.Abstract=abstractComponent;window.Tailor.Components.Lightbox=require("./shared/components/ui/lightbox");window.Tailor.Components.Map=require("./shared/components/ui/map");window.Tailor.Components.Masonry=require("./shared/components/ui/masonry");window.Tailor.Components.Parallax=require("./shared/components/ui/parallax");window.Tailor.Components.Slideshow=require("./shared/components/ui/slideshow");window.Tailor.Components.Tabs=require("./shared/components/ui/tabs");window.Tailor.Components.Toggles=require("./shared/components/ui/toggles");require("./frontend/components/ui/carousel");$(document).ready(function(){window.Tailor.initElements()})},{"./frontend/components/ui/carousel":2,"./shared/components/ui/abstract":3,"./shared/components/ui/lightbox":4,"./shared/components/ui/map":5,"./shared/components/ui/masonry":6,"./shared/components/ui/parallax":7,"./shared/components/ui/slideshow":8,"./shared/components/ui/tabs":9,"./shared/components/ui/toggles":10,"./shared/utility/polyfills/classlist":11,"./shared/utility/polyfills/raf":12,"./shared/utility/polyfills/transitions":13}],2:[function(require,module,exports){var $=window.jQuery,Carousel;Carousel=function(el,options,callbacks){this.el=el;this.$el=$(el);this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.options=$.extend(this.defaults,options,this.$el.data());if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.callbacks=$.extend(this.callbacks,callbacks);this.initialize()};Carousel.prototype={defaults:{items:"> .tailor-carousel__item",speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:false,adaptiveHeight:true,draggable:true,infinite:false,prevArrow:'',nextArrow:''},callbacks:{onInitialize:function(){},onDestroy:function(){}},initialize:function(){this.$items=this.$wrap.find(this.options.items);this.slick();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},slick:function(){this.$wrap.slick(this.options)},unSlick:function(){this.$wrap.slick("unslick")},destroy:function(e){this.unSlick();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}}};$.fn.tailorCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorCarousel");if(!instance){$.data(this,"tailorCarousel",new Carousel(this,options,callbacks))}})}},{}],3:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],4:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],5:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],6:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],7:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],9:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],10:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},initialize:function(){this.$el.accordion({header:".tailor-toggle h3"})}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],11:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;i'};options.dots=true}$el.tailorSlideshow(options)});$(".is-lightbox-gallery").each(function(){var $el=$(this);if($el.hasClass("tailor-carousel")){$el.tailorLightbox({delegate:".slick-slide:not( .slick-cloned ) .is-lightbox-image"})}else{$el.tailorLightbox()}});$(".is-lightbox-image").tailorLightbox({delegate:false})}};window.Tailor.Components.Abstract=abstractComponent;window.Tailor.Components.Lightbox=require("./shared/components/ui/lightbox");window.Tailor.Components.Map=require("./shared/components/ui/map");window.Tailor.Components.Masonry=require("./shared/components/ui/masonry");window.Tailor.Components.Parallax=require("./shared/components/ui/parallax");window.Tailor.Components.Slideshow=require("./shared/components/ui/slideshow");window.Tailor.Components.Tabs=require("./shared/components/ui/tabs");window.Tailor.Components.Toggles=require("./shared/components/ui/toggles");require("./frontend/components/ui/carousel");$(document).ready(function(){window.Tailor.initElements()})},{"./frontend/components/ui/carousel":2,"./shared/components/ui/abstract":3,"./shared/components/ui/lightbox":4,"./shared/components/ui/map":5,"./shared/components/ui/masonry":6,"./shared/components/ui/parallax":7,"./shared/components/ui/slideshow":8,"./shared/components/ui/tabs":9,"./shared/components/ui/toggles":10,"./shared/utility/polyfills/classlist":11,"./shared/utility/polyfills/raf":12,"./shared/utility/polyfills/transitions":13}],2:[function(require,module,exports){var $=window.jQuery,Carousel;Carousel=function(el,options,callbacks){this.el=el;this.$el=$(el);this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.options=$.extend(this.defaults,options,this.$el.data());if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.callbacks=$.extend(this.callbacks,callbacks);this.initialize()};Carousel.prototype={defaults:{items:"> .tailor-carousel__item",speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:false,adaptiveHeight:true,draggable:true,infinite:false,prevArrow:'',nextArrow:''},callbacks:{onInitialize:function(){},onDestroy:function(){}},initialize:function(){this.$items=this.$wrap.find(this.options.items);this.slick();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},slick:function(){this.$wrap.slick(this.options)},unSlick:function(){this.$wrap.slick("unslick")},destroy:function(e){this.unSlick();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}}};$.fn.tailorCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorCarousel");if(!instance){$.data(this,"tailorCarousel",new Carousel(this,options,callbacks))}})}},{}],3:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],4:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],5:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],6:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],7:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],9:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],10:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},initialize:function(){var self=this;var initial=self.options.initial-1;if(initial<=0){initial=false}var accordionOverrideCallback=function(){};if(self.options.accordion){accordionOverrideCallback=self.allowMultiplePanesOpen}this.$el.accordion({header:".tailor-toggle .tailor-toggle__title",collapsible:true,active:initial,animate:self.options.speed,beforeActivate:accordionOverrideCallback})},allowMultiplePanesOpen:function(event,ui){if(ui.newHeader[0]){var currHeader=ui.newHeader;var currContent=currHeader.next(".ui-accordion-content")}else{var currHeader=ui.oldHeader;var currContent=currHeader.next(".ui-accordion-content")}var isPanelSelected=currHeader.attr("aria-selected")=="true";currHeader.toggleClass("ui-corner-all",isPanelSelected).toggleClass("accordion-header-active ui-state-active ui-corner-top",!isPanelSelected).attr("aria-selected",(!isPanelSelected).toString());currHeader.children(".ui-icon").toggleClass("ui-icon-triangle-1-e",isPanelSelected).toggleClass("ui-icon-triangle-1-s",!isPanelSelected);currContent.toggleClass("accordion-content-active",!isPanelSelected);if(isPanelSelected){currContent.slideUp()}else{currContent.slideDown()}return false}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],11:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;i Date: Fri, 10 Mar 2017 15:17:20 -0600 Subject: [PATCH 6/8] Removing original code and wp-style-guidifying the rest for toggles --- assets/js/dist/canvas.js | 119 +++--------------- assets/js/dist/frontend.js | 119 +++--------------- assets/js/src/shared/components/ui/toggles.js | 119 +++--------------- 3 files changed, 48 insertions(+), 309 deletions(-) diff --git a/assets/js/dist/canvas.js b/assets/js/dist/canvas.js index 38d29bc..2c239d3 100644 --- a/assets/js/dist/canvas.js +++ b/assets/js/dist/canvas.js @@ -9420,12 +9420,12 @@ Toggles = Components.create( { initialize : function() { var self = this; var initial = self.options.initial - 1; - if (initial <= 0) { + if ( initial <= 0 ) { initial = false; } var accordionOverrideCallback = function(){}; - if (self.options.accordion){ + if ( self.options.accordion ){ accordionOverrideCallback = self.allowMultiplePanesOpen; } @@ -9434,7 +9434,7 @@ Toggles = Components.create( { collapsible : true, active : initial, animate : self.options.speed, - beforeActivate: accordionOverrideCallback + beforeActivate : accordionOverrideCallback }); }, @@ -9446,122 +9446,35 @@ Toggles = Components.create( { * @see http://stackoverflow.com/questions/3479447/jquery-ui-accordion-that-keeps-multiple-sections-open * @since TODO */ - allowMultiplePanesOpen : function(event, ui) { + allowMultiplePanesOpen : function( event, ui ) { // The accordion believes a panel is being opened - if (ui.newHeader[0]) { + if ( ui.newHeader[0] ) { var currHeader = ui.newHeader; - var currContent = currHeader.next('.ui-accordion-content'); + var currContent = currHeader.next( '.ui-accordion-content' ); // The accordion believes a panel is being closed } else { var currHeader = ui.oldHeader; - var currContent = currHeader.next('.ui-accordion-content'); + var currContent = currHeader.next( '.ui-accordion-content' ); } // Since we've changed the default behavior, this detects the actual status - var isPanelSelected = currHeader.attr('aria-selected') == 'true'; + var isPanelSelected = currHeader.attr( 'aria-selected' ) == 'true'; // Toggle the panel's header - currHeader.toggleClass('ui-corner-all',isPanelSelected).toggleClass('accordion-header-active ui-state-active ui-corner-top',!isPanelSelected).attr('aria-selected',((!isPanelSelected).toString())); + currHeader.toggleClass( 'ui-corner-all', isPanelSelected ).toggleClass( 'accordion-header-active ui-state-active ui-corner-top', ! isPanelSelected ).attr( 'aria-selected', ( ( ! isPanelSelected).toString() ) ); // Toggle the panel's icon - currHeader.children('.ui-icon').toggleClass('ui-icon-triangle-1-e',isPanelSelected).toggleClass('ui-icon-triangle-1-s',!isPanelSelected); + currHeader.children( '.ui-icon' ).toggleClass( 'ui-icon-triangle-1-e' ,isPanelSelected ).toggleClass( 'ui-icon-triangle-1-s', ! isPanelSelected ); // Toggle the panel's content - currContent.toggleClass('accordion-content-active',!isPanelSelected) - if (isPanelSelected) { currContent.slideUp(); } else { currContent.slideDown(); } + currContent.toggleClass( 'accordion-content-active', ! isPanelSelected ) + if ( isPanelSelected ) { + currContent.slideUp(); + } else { + currContent.slideDown(); + } return false; // Cancels the default action } - - // /** - // * Initializes the component. - // * - // * @since 1.7.5 - // */ - // onInitialize : function() { - // this.querySelectors(); - // - // var initial = this.options.initial - 1; - // if ( initial >= 0 && this.$toggles.length > initial ) { - // this.activate( this.$toggles[ initial ] ); - // } - // }, - // - // /** - // * Caches the toggles and toggle content. - // * - // * @since 1.0.0 - // */ - // querySelectors : function() { - // this.$content = this.$el.find( this.options.content ).hide(); - // this.$toggles = this.$el - // .find( this.options.toggles ) - // .off() - // .on( 'click', $.proxy( this.onClick, this ) ); - // }, - // - // /** - // * Activates a given toggle. - // * - // * @since 1.0.0 - // * - // * @param el - // */ - // activate: function( el ) { - // var speed = this.options.speed; - // var $el = $( el ); - // - // if ( this.options.accordion ) { - // this.$toggles.filter( function() { - // return this !== el; - // } ).removeClass( 'is-active' ); - // - // this.$content.each( function() { - // var $toggle = $( this ); - // if ( el.nextElementSibling == this ) { - // $toggle.slideToggle( speed ); - // } - // else { - // $toggle.slideUp( speed ); - // } - // } ); - // } - // else { - // this.$content - // .filter( function() { return el.nextElementSibling == this; } ) - // .slideToggle( speed ); - // } - // - // $el.toggleClass( 'is-active' ); - // - // $win.trigger( 'resize' ); - // }, - // - // /** - // * Activates a toggle when it is clicked. - // * - // * @since 1.7.5 - // * - // * @param e - // */ - // onClick: function( e ) { - // this.activate( e.target ); - // e.preventDefault(); - // }, - // - // /** - // * Element listeners - // */ - // onDestroy: function( e ) { - // this.$toggles.off(); - // }, - // - // /** - // * Child listeners - // */ - // onChangeChild: function() { - // this.querySelectors(); - // } - } ); /** diff --git a/assets/js/dist/frontend.js b/assets/js/dist/frontend.js index 4164897..ef8a820 100644 --- a/assets/js/dist/frontend.js +++ b/assets/js/dist/frontend.js @@ -1980,12 +1980,12 @@ Toggles = Components.create( { initialize : function() { var self = this; var initial = self.options.initial - 1; - if (initial <= 0) { + if ( initial <= 0 ) { initial = false; } var accordionOverrideCallback = function(){}; - if (self.options.accordion){ + if ( self.options.accordion ){ accordionOverrideCallback = self.allowMultiplePanesOpen; } @@ -1994,7 +1994,7 @@ Toggles = Components.create( { collapsible : true, active : initial, animate : self.options.speed, - beforeActivate: accordionOverrideCallback + beforeActivate : accordionOverrideCallback }); }, @@ -2006,122 +2006,35 @@ Toggles = Components.create( { * @see http://stackoverflow.com/questions/3479447/jquery-ui-accordion-that-keeps-multiple-sections-open * @since TODO */ - allowMultiplePanesOpen : function(event, ui) { + allowMultiplePanesOpen : function( event, ui ) { // The accordion believes a panel is being opened - if (ui.newHeader[0]) { + if ( ui.newHeader[0] ) { var currHeader = ui.newHeader; - var currContent = currHeader.next('.ui-accordion-content'); + var currContent = currHeader.next( '.ui-accordion-content' ); // The accordion believes a panel is being closed } else { var currHeader = ui.oldHeader; - var currContent = currHeader.next('.ui-accordion-content'); + var currContent = currHeader.next( '.ui-accordion-content' ); } // Since we've changed the default behavior, this detects the actual status - var isPanelSelected = currHeader.attr('aria-selected') == 'true'; + var isPanelSelected = currHeader.attr( 'aria-selected' ) == 'true'; // Toggle the panel's header - currHeader.toggleClass('ui-corner-all',isPanelSelected).toggleClass('accordion-header-active ui-state-active ui-corner-top',!isPanelSelected).attr('aria-selected',((!isPanelSelected).toString())); + currHeader.toggleClass( 'ui-corner-all', isPanelSelected ).toggleClass( 'accordion-header-active ui-state-active ui-corner-top', ! isPanelSelected ).attr( 'aria-selected', ( ( ! isPanelSelected).toString() ) ); // Toggle the panel's icon - currHeader.children('.ui-icon').toggleClass('ui-icon-triangle-1-e',isPanelSelected).toggleClass('ui-icon-triangle-1-s',!isPanelSelected); + currHeader.children( '.ui-icon' ).toggleClass( 'ui-icon-triangle-1-e' ,isPanelSelected ).toggleClass( 'ui-icon-triangle-1-s', ! isPanelSelected ); // Toggle the panel's content - currContent.toggleClass('accordion-content-active',!isPanelSelected) - if (isPanelSelected) { currContent.slideUp(); } else { currContent.slideDown(); } + currContent.toggleClass( 'accordion-content-active', ! isPanelSelected ) + if ( isPanelSelected ) { + currContent.slideUp(); + } else { + currContent.slideDown(); + } return false; // Cancels the default action } - - // /** - // * Initializes the component. - // * - // * @since 1.7.5 - // */ - // onInitialize : function() { - // this.querySelectors(); - // - // var initial = this.options.initial - 1; - // if ( initial >= 0 && this.$toggles.length > initial ) { - // this.activate( this.$toggles[ initial ] ); - // } - // }, - // - // /** - // * Caches the toggles and toggle content. - // * - // * @since 1.0.0 - // */ - // querySelectors : function() { - // this.$content = this.$el.find( this.options.content ).hide(); - // this.$toggles = this.$el - // .find( this.options.toggles ) - // .off() - // .on( 'click', $.proxy( this.onClick, this ) ); - // }, - // - // /** - // * Activates a given toggle. - // * - // * @since 1.0.0 - // * - // * @param el - // */ - // activate: function( el ) { - // var speed = this.options.speed; - // var $el = $( el ); - // - // if ( this.options.accordion ) { - // this.$toggles.filter( function() { - // return this !== el; - // } ).removeClass( 'is-active' ); - // - // this.$content.each( function() { - // var $toggle = $( this ); - // if ( el.nextElementSibling == this ) { - // $toggle.slideToggle( speed ); - // } - // else { - // $toggle.slideUp( speed ); - // } - // } ); - // } - // else { - // this.$content - // .filter( function() { return el.nextElementSibling == this; } ) - // .slideToggle( speed ); - // } - // - // $el.toggleClass( 'is-active' ); - // - // $win.trigger( 'resize' ); - // }, - // - // /** - // * Activates a toggle when it is clicked. - // * - // * @since 1.7.5 - // * - // * @param e - // */ - // onClick: function( e ) { - // this.activate( e.target ); - // e.preventDefault(); - // }, - // - // /** - // * Element listeners - // */ - // onDestroy: function( e ) { - // this.$toggles.off(); - // }, - // - // /** - // * Child listeners - // */ - // onChangeChild: function() { - // this.querySelectors(); - // } - } ); /** diff --git a/assets/js/src/shared/components/ui/toggles.js b/assets/js/src/shared/components/ui/toggles.js index da1433c..0650004 100644 --- a/assets/js/src/shared/components/ui/toggles.js +++ b/assets/js/src/shared/components/ui/toggles.js @@ -25,12 +25,12 @@ Toggles = Components.create( { initialize : function() { var self = this; var initial = self.options.initial - 1; - if (initial <= 0) { + if ( initial <= 0 ) { initial = false; } var accordionOverrideCallback = function(){}; - if (self.options.accordion){ + if ( self.options.accordion ){ accordionOverrideCallback = self.allowMultiplePanesOpen; } @@ -39,7 +39,7 @@ Toggles = Components.create( { collapsible : true, active : initial, animate : self.options.speed, - beforeActivate: accordionOverrideCallback + beforeActivate : accordionOverrideCallback }); }, @@ -51,122 +51,35 @@ Toggles = Components.create( { * @see http://stackoverflow.com/questions/3479447/jquery-ui-accordion-that-keeps-multiple-sections-open * @since TODO */ - allowMultiplePanesOpen : function(event, ui) { + allowMultiplePanesOpen : function( event, ui ) { // The accordion believes a panel is being opened - if (ui.newHeader[0]) { + if ( ui.newHeader[0] ) { var currHeader = ui.newHeader; - var currContent = currHeader.next('.ui-accordion-content'); + var currContent = currHeader.next( '.ui-accordion-content' ); // The accordion believes a panel is being closed } else { var currHeader = ui.oldHeader; - var currContent = currHeader.next('.ui-accordion-content'); + var currContent = currHeader.next( '.ui-accordion-content' ); } // Since we've changed the default behavior, this detects the actual status - var isPanelSelected = currHeader.attr('aria-selected') == 'true'; + var isPanelSelected = currHeader.attr( 'aria-selected' ) == 'true'; // Toggle the panel's header - currHeader.toggleClass('ui-corner-all',isPanelSelected).toggleClass('accordion-header-active ui-state-active ui-corner-top',!isPanelSelected).attr('aria-selected',((!isPanelSelected).toString())); + currHeader.toggleClass( 'ui-corner-all', isPanelSelected ).toggleClass( 'accordion-header-active ui-state-active ui-corner-top', ! isPanelSelected ).attr( 'aria-selected', ( ( ! isPanelSelected).toString() ) ); // Toggle the panel's icon - currHeader.children('.ui-icon').toggleClass('ui-icon-triangle-1-e',isPanelSelected).toggleClass('ui-icon-triangle-1-s',!isPanelSelected); + currHeader.children( '.ui-icon' ).toggleClass( 'ui-icon-triangle-1-e' ,isPanelSelected ).toggleClass( 'ui-icon-triangle-1-s', ! isPanelSelected ); // Toggle the panel's content - currContent.toggleClass('accordion-content-active',!isPanelSelected) - if (isPanelSelected) { currContent.slideUp(); } else { currContent.slideDown(); } + currContent.toggleClass( 'accordion-content-active', ! isPanelSelected ) + if ( isPanelSelected ) { + currContent.slideUp(); + } else { + currContent.slideDown(); + } return false; // Cancels the default action } - - // /** - // * Initializes the component. - // * - // * @since 1.7.5 - // */ - // onInitialize : function() { - // this.querySelectors(); - // - // var initial = this.options.initial - 1; - // if ( initial >= 0 && this.$toggles.length > initial ) { - // this.activate( this.$toggles[ initial ] ); - // } - // }, - // - // /** - // * Caches the toggles and toggle content. - // * - // * @since 1.0.0 - // */ - // querySelectors : function() { - // this.$content = this.$el.find( this.options.content ).hide(); - // this.$toggles = this.$el - // .find( this.options.toggles ) - // .off() - // .on( 'click', $.proxy( this.onClick, this ) ); - // }, - // - // /** - // * Activates a given toggle. - // * - // * @since 1.0.0 - // * - // * @param el - // */ - // activate: function( el ) { - // var speed = this.options.speed; - // var $el = $( el ); - // - // if ( this.options.accordion ) { - // this.$toggles.filter( function() { - // return this !== el; - // } ).removeClass( 'is-active' ); - // - // this.$content.each( function() { - // var $toggle = $( this ); - // if ( el.nextElementSibling == this ) { - // $toggle.slideToggle( speed ); - // } - // else { - // $toggle.slideUp( speed ); - // } - // } ); - // } - // else { - // this.$content - // .filter( function() { return el.nextElementSibling == this; } ) - // .slideToggle( speed ); - // } - // - // $el.toggleClass( 'is-active' ); - // - // $win.trigger( 'resize' ); - // }, - // - // /** - // * Activates a toggle when it is clicked. - // * - // * @since 1.7.5 - // * - // * @param e - // */ - // onClick: function( e ) { - // this.activate( e.target ); - // e.preventDefault(); - // }, - // - // /** - // * Element listeners - // */ - // onDestroy: function( e ) { - // this.$toggles.off(); - // }, - // - // /** - // * Child listeners - // */ - // onChangeChild: function() { - // this.querySelectors(); - // } - } ); /** From 774dcec4abfb9cf67bacf31470304824768c283c Mon Sep 17 00:00:00 2001 From: Kristofer Raske Date: Thu, 30 Mar 2017 16:22:02 -0500 Subject: [PATCH 7/8] Missing Link: Event listeners on toggles working again Turns out I needed to use onInitialize or the built in event listeners would totally not work. In order to get the backend canvas working we need those events like onChildChange etc to reinitialize the accordion, and to get those events we needed to go though the right channels --- assets/js/dist/canvas.js | 18 ++++++++++++++++-- assets/js/dist/canvas.min.js | 10 +++++----- assets/js/dist/frontend.js | 18 ++++++++++++++++-- assets/js/dist/frontend.min.js | 2 +- assets/js/dist/sidebar.min.js | 8 ++++---- assets/js/src/shared/components/ui/toggles.js | 18 ++++++++++++++++-- 6 files changed, 58 insertions(+), 16 deletions(-) diff --git a/assets/js/dist/canvas.js b/assets/js/dist/canvas.js index 2c239d3..15e059c 100644 --- a/assets/js/dist/canvas.js +++ b/assets/js/dist/canvas.js @@ -9417,7 +9417,7 @@ Toggles = Components.create( { }; }, - initialize : function() { + onInitialize : function() { var self = this; var initial = self.options.initial - 1; if ( initial <= 0 ) { @@ -9438,13 +9438,27 @@ Toggles = Components.create( { }); }, + /** + * Element listeners + */ + onDestroy: function( e ) { + this.$el.accordion( 'destroy' ); + }, + + /** + * Child listeners + */ + onChangeChild: function() { + this.$el.accordion( 'destroy' ); + this.onInitialize(); + }, + /** * Special JQueryUI default activation behavior to allow multiple * toggles to be open at once. This is necessary to preserve the "accordion" * feature. * * @see http://stackoverflow.com/questions/3479447/jquery-ui-accordion-that-keeps-multiple-sections-open - * @since TODO */ allowMultiplePanesOpen : function( event, ui ) { // The accordion believes a panel is being opened diff --git a/assets/js/dist/canvas.min.js b/assets/js/dist/canvas.min.js index e75a01d..f48c76a 100644 --- a/assets/js/dist/canvas.min.js +++ b/assets/js/dist/canvas.min.js @@ -1,5 +1,5 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o'+'
    '+"
    ")},onResize:function(e){var columnView=this;var device=app.channel.request("sidebar:device");var setting="desktop"==device?"width":"width_"+device;var model=columnView.model;var nextModel=model.collection.findWhere({parent:model.get("parent"),order:model.get("order")+1});var atts=model.get("atts");var nextAtts=nextModel.get("atts");var width=parseFloat(atts[setting]||atts.width);var nextWidth=parseFloat(nextAtts[setting]||nextAtts.width);var columnsWidth=width+nextWidth;var column=columnView.el.getBoundingClientRect();var $first=$(''+width+"%");var $second=$(''+nextWidth+"%");$first.prependTo(columnView.$el);$second.prependTo(columnView.$el.next());function onResize(e){document.body.classList.add("is-resizing");document.body.style.cursor="col-resize";var columnWidth=Math.min(columnsWidth-10,Math.max(10,Math.round(parseFloat((e.clientX-column.left)/column.width*width)*10)/10));var nextColumnWidth=Math.round(parseFloat(columnsWidth-columnWidth)*10)/10;columnWidth+="%";nextColumnWidth+="%";$first.html(columnWidth);$second.html(nextColumnWidth);var atts=_.clone(model.get("atts"));var nextAtts=_.clone(nextModel.get("atts"));atts[setting]=columnWidth;nextAtts[setting]=nextColumnWidth;model.set("atts",atts,{silent:true});nextModel.set("atts",nextAtts,{silent:true});model.trigger("change:width",model,atts);nextModel.trigger("change:width",nextModel,nextAtts)}function onResizeEnd(){document.removeEventListener("mousemove",onResize,false);document.removeEventListener("mouseup",onResizeEnd,false);document.body.classList.remove("is-resizing");document.body.style.cursor="default";$first.remove();$second.remove();var atts=model.get("atts");if(width!=atts[setting]){app.channel.trigger("element:resize",model)}}document.addEventListener("mousemove",onResize,false);document.addEventListener("mouseup",onResizeEnd,false);app.channel.trigger("canvas:reset");return false},onChangeWidth:function(model,atts){this.updateCSS(model.get("id"),atts);this.triggerAll("element:refresh",this)},updateCSS:function(elementId,atts){var ruleSet={};var width=atts["width"];var tabletWidth=atts["width_tablet"]||atts["width"];var mobileWidth=atts["width_mobile"]||atts["width"];ruleSet["desktop"]={};ruleSet["desktop"][elementId]=[{selectors:[],declarations:{width:width},setting:"width"}];ruleSet["tablet"]={};ruleSet["tablet"][elementId]=[{selectors:[".mobile-columns &",".tablet-columns &"],declarations:{width:tabletWidth},setting:"width_tablet"}];ruleSet["mobile"]={};ruleSet["mobile"][elementId]=[{selectors:[".mobile-columns &"],declarations:{width:mobileWidth},setting:"width_mobile"}];cssModule.deleteRules(elementId,"width");cssModule.deleteRules(elementId,"width_tablet");cssModule.deleteRules(elementId,"width_mobile");cssModule.addRules(ruleSet)}});module.exports=ColumnView},{"./../element-container":17}],10:[function(require,module,exports){var ContainerView=require("./../element-container"),TabView;TabView=ContainerView.extend({onRenderTemplate:function(){this.el.draggable=false;this.el.id=this.model.cid}});module.exports=TabView},{"./../element-container":17}],11:[function(require,module,exports){var ContainerView=require("./../element-container"),CarouselNavigationView=require("./navigation/carousel-navigation"),CarouselView;CarouselView=ContainerView.extend({onBeforeRenderTemplate:function(){if(this.navigation){this.navigation.triggerMethod("destroy")}},onRenderTemplate:function(){this.navigation=new CarouselNavigationView({model:this.model,collection:this.collection,sort:false});this.$el.append(this.navigation.render().el)},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this);this.navigation.triggerMethod("destroy")}});module.exports=CarouselView},{"./../element-container":17,"./navigation/carousel-navigation":13}],12:[function(require,module,exports){module.exports=Marionette.ItemView.extend({tagName:"li",attributes:function(){return{"data-id":this.model.cid}},getTemplate:function(){return _.template('')}})},{}],13:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({tagName:"ul",className:"slick-dots",childView:require("./carousel-navigation-item"),events:{dragstart:"onDragStart"},onDragStart:function(e){app.channel.trigger("canvas:reset");e.stopPropagation()},onRender:function(){var view=this;this.sortable=new Sortable(view.el,{draggable:"li",animation:150,onUpdate:function(e){var cid=e.item.getAttribute("data-id");view.$el.trigger("before:navigation:reorder",[cid,e.newIndex,e.oldIndex]);view.$el.trigger("navigation:reorder",[cid,e.newIndex,e.oldIndex]);app.channel.trigger("navigation:reorder",view.model)}})},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return child.get("parent")===this.model.get("id")},onBeforeDestroy:function(){this.sortable.destroy()}})},{"./carousel-navigation-item":12}],14:[function(require,module,exports){module.exports=Marionette.ItemView.extend({tagName:"li",className:function(){return"tailor-tabs__navigation-item tailor-"+this.model.get("id")},modelEvents:{"change:atts":"onChangeAttributes"},attributes:function(){return{"data-id":this.model.cid}},getTemplate:function(){return _.template('<%= title || "Tab" %>')},serializeData:function(){var data=Marionette.ItemView.prototype.serializeData.apply(this,arguments);var atts=this.model.get("atts");data.title=atts.title;return data},onChangeAttributes:function(model,atts){this.el.innerHTML=atts.title||"Tab"}})},{}],15:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({childView:require("./tabs-navigation-item"),events:{dragstart:"onDragStart"},onDragStart:function(e){app.channel.trigger("canvas:reset");e.stopPropagation()},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return child.get("parent")===this.model.get("id")},onRender:function(){var view=this;this.sortable=new Sortable(view.el,{draggable:"li",animation:150,onUpdate:function(e){var cid=e.item.getAttribute("data-id");view.$el.trigger("before:navigation:reorder",[cid,e.newIndex,e.oldIndex]);view.$el.trigger("navigation:reorder",[cid,e.newIndex,e.oldIndex]);app.channel.trigger("navigation:reorder",view.model)}})},onBeforeDestroy:function(){this.sortable.destroy()}})},{"./tabs-navigation-item":14}],16:[function(require,module,exports){var ContainerView=require("./../element-container"),TabsNavigationView=require("./navigation/tabs-navigation"),TabsView;TabsView=ContainerView.extend({ui:{navigation:".tailor-tabs__navigation"},onBeforeRenderTemplate:function(){if(this.navigation){this.navigation.triggerMethod("destroy")}},onRenderTemplate:function(){this.navigation=new TabsNavigationView({el:this.ui.navigation,model:this.model,collection:this.collection,sort:false});this.navigation.render()},childRefreshed:function(childView){childView.el.id=childView.model.cid;childView.el.classList.add("is-active");this.triggerAll("element:child:refresh",childView)},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this);this.navigation.triggerMethod("destroy")}});module.exports=TabsView},{"./../element-container":17,"./navigation/tabs-navigation":15}],17:[function(require,module,exports){var CompositeView=Marionette.CompositeView.extend({behaviors:{Container:{},Draggable:{},Droppable:{},Editable:{},Movable:{}},modelEvents:{"change:atts":"onChangeAttributes","change:order":"onChangeOrder","change:parent":"onChangeParent","change:setting":"onChangeSetting"},childEvents:{"before:element:ready":"beforeChildElementReady","element:ready":"childElementReady","before:element:refresh":"beforeChildElementRefreshed","element:refresh":"childElementRefreshed","before:element:jsRefresh":"beforeChildElementJSRefreshed","element:jsRefresh":"childElementJSRefreshed","element:change:parent":"childElementChangeParent","element:change:order":"childElementChangeOrder","before:element:destroy":"beforeChildElementDestroyed","element:destroy":"childElementDestroyed"},events:{"before:element:ready":"stopEventPropagation","element:ready":"stopEventPropagation","before:element:refresh":"stopEventPropagation","element:refresh":"stopEventPropagation","before:element:copy":"stopEventPropagation","element:copy":"stopEventPropagation","element:child:change:parent":"onDescendantChangeParent","element:child:change:order":"onDescendantChangeOrder","before:element:destroy":"stopEventPropagation","element:destroy":"stopEventPropagation","element:child:add":"onDescendantAdded","element:child:remove":"onDescendantRemoved","before:element:child:ready":"onBeforeDescendantReady","element:child:ready":"onDescendantReady","before:element:child:refresh":"onBeforeDescendantRefreshed","element:child:refresh":"onDescendantRefreshed","before:element:child:jsRefresh":"onBeforeDescendantJSRefreshed","element:child:jsRefresh":"onDescendantJSRefreshed","before:element:child:destroy":"onBeforeDescendantDestroyed","element:child:destroy":"onDescendantDestroyed","before:navigation:reorder":"stopEventPropagation","navigation:reorder":"onReorder"},onReorder:function(e,cid,index,oldIndex){var view=this.children.findByModelCid(cid);var otherView=this.children.find(function(childView){return childView.model.get("order")==index});if(oldIndex-index<0){view.$el.insertAfter(otherView.$el)}else{view.$el.insertBefore(otherView.$el)}this.children.each(function(childView){var childIndex=childView.$el.index();childView._index=childIndex;childView.model.set("order",childIndex)});view.model.collection.sort();e.stopPropagation()},onChangeAttributes:_.debounce(function(model,atts){model=this.model.toJSON();model.atts=atts?atts:{};var view=this;view.el.classList.add("is-rendering");window.ajax.send("tailor_render",{data:{model:JSON.stringify(model),nonce:window._nonces.render},success:function(response){view.updateTemplate(response.html);var id=view.model.get("id");app.channel.trigger("css:update",id,response.css)},error:function(response){view.updateTemplate('

    The template for '+view.cid+" could not be refreshed

    ");console.log(response)},complete:function(){var isEditing=view.$el.hasClass("is-editing");var isSelected=view.$el.hasClass("is-selected");view.$el.removeClass("is-rendering");view.triggerAll("before:element:refresh",view,model.atts);view.renderTemplate();view.triggerAll("element:refresh",view,model.atts);if(isEditing){view.$el.addClass("is-editing")}if(isSelected){view.$el.addClass("is-selected")}}})},250),onChangeOrder:function(){this.triggerAll("element:change:order",this)},onChangeParent:function(){this.triggerAll("element:change:parent",this)},onChangeSetting:function(setting,refresh){if(refresh){this.triggerAll("before:element:jsRefresh",this,this.model.get("atts"));app.channel.trigger("element:setting:change",setting,this);this.triggerAll("element:jsRefresh",this,this.model.get("atts"))}},initialize:function(){this._isReady=false;this._isBeingDestroyed=false;this.options.childViewContainer=this.model.get("child_container")||null;this.addEventListeners()},addEventListeners:function(){this.listenTo(app.channel,"before:elements:restore",this.onBeforeDestroy)},getChildView:function(child){return Tailor.lookup(child.get("tag"),child.get("type"),"Views")},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return child.get("parent")===this.model.get("id")},attachElContent:function(html){var $el=jQuery(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("draggable",true);this.el.setAttribute("tailor-label",this.model.get("label"));this.el.classList.add("tailor-"+this.model.cid);this.el.title=_l10n.edit_element;return this},getTemplateId:function(){return"tmpl-tailor-"+this.model.get("id")},getTemplate:function(){var el=document.querySelector("#"+this.getTemplateId());var template;if(el){template=_.template(el.innerHTML);el.parentElement.removeChild(el)}else{el=document.querySelector("#tmpl-tailor-"+this.model.get("tag")+"-default");template=_.template(el.innerHTML)}return template},updateTemplate:function(html){var templateId=this.getTemplateId();var el=document.querySelector("#"+templateId);if(!el){el=document.createElement("script");el.setAttribute("type","text/html");el.id=templateId;document.body.appendChild(el)}el.innerHTML=html},renderTemplate:function(){this._ensureViewIsIntact();var $childViewContainer=this.getChildViewContainer(this);var $children=$childViewContainer.contents().detach();this.resetChildViewContainer();this._renderTemplate();$childViewContainer=this.getChildViewContainer(this);$childViewContainer.append($children);return this},onBeforeRender:function(){this.triggerAll("before:element:ready",this)},onDomRefresh:function(){this.$el.find("a").attr({draggable:false,target:"_blank"});this.$el.find("img").attr({draggable:false})},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this)},onDestroy:function(){this.triggerAll("element:destroy",this)},beforeChildElementReady:function(childView){if(this._isReady&&this.children.contains(childView)){this.triggerAll("before:element:child:ready",childView)}},childElementReady:function(childView){if(this.children.contains(childView)){if(!this._isReady){var readyChildren=this.children.filter(function(childView){return childView._isReady}).length;if(this.children.length==readyChildren){this._isReady=true;this.triggerAll("element:ready",this)}}else{this.triggerAll("element:child:ready",childView)}}},beforeChildElementRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("before:element:child:refresh",childView)}},childElementRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:refresh",childView)}},beforeChildElementJSRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("before:element:child:jsRefresh",childView)}},childElementJSRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:jsRefresh",childView)}},childElementChangeOrder:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:change:order",childView)}},childElementChangeParent:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:change:parent",childView)}},beforeChildElementDestroyed:function(childView){if(!this._isBeingDestroyed){this.triggerAll("before:element:child:destroy",childView)}},childElementDestroyed:function(childView){if(!this._isBeingDestroyed){this.triggerAll("element:child:destroy",childView)}},onDescendantAdded:function(e,view){this.triggerAll("element:descendant:add",view);e.stopPropagation()},onDescendantRemoved:function(e,view){this.triggerAll("element:descendant:remove",view);e.stopPropagation()},onBeforeDescendantReady:function(e,view){this.triggerAll("before:element:descendant:ready",view);e.stopPropagation()},onDescendantReady:function(e,view){this.triggerAll("element:descendant:ready",view);e.stopPropagation()},onBeforeDescendantRefreshed:function(e,view){this.triggerAll("before:element:descendant:refresh",view);e.stopPropagation()},onDescendantRefreshed:function(e,view){this.triggerAll("element:descendant:refresh",view);e.stopPropagation()},onBeforeDescendantJSRefreshed:function(e,view){this.triggerAll("before:element:descendant:jsRefresh",view);e.stopPropagation()},onDescendantJSRefreshed:function(e,view){this.triggerAll("element:descendant:jsRefresh",view);e.stopPropagation()},onDescendantChangeOrder:function(e,view){this.triggerAll("element:descendant:change:order",view);e.stopPropagation()},onDescendantChangeParent:function(e,view){this.triggerAll("element:descendant:change:parent",view);e.stopPropagation()},onBeforeDescendantDestroyed:function(e,view){this.triggerAll("before:element:descendant:destroy",view);e.stopPropagation()},onDescendantDestroyed:function(e,view){this.triggerAll("element:descendant:destroy",view);e.stopPropagation()},stopEventPropagation:function(e){e.stopPropagation()},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}},_updateIndices:function(view,increment,index){if(increment){view._index=index;view.model._changing=false;view.model.set("order",index)}this.children.each(function(laterView){if(laterView._index>=view._index){laterView._index+=increment?1:-1; -laterView.model.set("order",laterView._index)}},this)}});module.exports=CompositeView},{}],18:[function(require,module,exports){var $=window.jQuery,ElementView;ElementView=Marionette.ItemView.extend({className:"element",attributes:{draggable:true},behaviors:{Draggable:{},Droppable:{},Editable:{},Movable:{}},modelEvents:{"change:atts":"onChangeAttributes","change:parent":"onChangeParent","change:setting":"onChangeSetting"},initialize:function(){this._isReady=false;this._isBeingDestroyed=false;this.addEventListeners()},addEventListeners:function(){this.listenTo(app.channel,"before:elements:restore",this.onBeforeDestroy)},getTemplateId:function(){return"tmpl-tailor-"+this.model.get("id")},getTemplate:function(){var el=document.querySelector("#"+this.getTemplateId());var template;if(el){template=_.template(el.innerHTML);el.parentElement.removeChild(el)}else{el=document.querySelector("#tmpl-tailor-"+this.model.get("tag")+"-default");template=_.template(el.innerHTML)}return template},attachElContent:function(html){var $el=$(html);var el=$el[0];this.$el.replaceWith(el);this.setElement(el);this.el.setAttribute("draggable",true);this.el.setAttribute("tailor-label",this.model.get("label"));this.el.classList.add("tailor-"+this.model.id);this.el.title=_l10n.edit_element;return this},updateTemplate:function(html){var templateId=this.getTemplateId();var el=document.querySelector("#"+templateId);if(!el){el=document.createElement("script");el.setAttribute("type","text/html");el.id=templateId;document.body.appendChild(el)}el.innerHTML=html},onChangeAttributes:_.debounce(function(model,atts){var view=this;model=model.toJSON();if(atts){model.atts=atts}view.el.classList.add("is-rendering");window.ajax.send("tailor_render",{data:{model:JSON.stringify(model),nonce:window._nonces.render},success:function(response){view.updateTemplate(response.html);app.channel.trigger("css:update",view.model.get("id"),response.css)},error:function(response){view.updateTemplate('

    The template for '+view.cid+" could not be refreshed

    ");console.log(response)},complete:function(){var isEditing=view.$el.hasClass("is-editing");var isSelected=view.$el.hasClass("is-selected");view.$el.removeClass("is-rendering");view.triggerAll("before:element:refresh",view,model.atts);view.render();view.triggerAll("element:refresh",view,model.atts);if(isEditing){view.$el.addClass("is-editing")}if(isSelected){view.$el.addClass("is-selected")}}})},500),onChangeSetting:function(setting,refresh){if(refresh){this.triggerAll("before:element:jsRefresh",this,this.model.get("atts"));app.channel.trigger("element:setting:change",setting,this);this.triggerAll("element:jsRefresh",this,this.model.get("atts"))}},onChangeParent:function(){this.triggerAll("element:change:parent",this)},onBeforeRender:function(){this.triggerAll("before:element:ready",this)},onDomRefresh:function(){var view=this;this.$el.find("a").attr({draggable:false,target:"_blank"});this.$el.find("[onchange]").removeAttr("onchange");this.$el.find("img").attr({draggable:false});this.$el.imagesLoaded(function(){view._isReady=true;if(view.el.classList.contains("tailor-widget")&&0==view.$el.children().innerHeight()){var el=document.querySelector("#tmpl-tailor-element-empty");if(el){view.$el.html(el.innerHTML)}}view.triggerAll("element:ready",view)})},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this)},onDestroy:function(){this.triggerAll("element:destroy",this)},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}}});module.exports=ElementView},{}],19:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Carousel;Carousel=Components.create({slickActive:false,getDefaults:function(){return{items:".tailor-carousel__item",prevArrow:'',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:true,fade:false}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.slick()},slick:function(){var component=this;component.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){this.$wrap.slick("refresh")},unSlick:function(){this.$wrap.slick("unslick")},onMove:function(){if(this.slickActive){this.refreshSlick()}},onBeforeCopy:function(){if(this.slickActive){this.unSlick()}},onCopy:function(){if(!this.slickActive){this.slick()}},onBeforeRefresh:function(){if(this.slickActive){this.unSlick()}},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){if(this.slickActive){this.unSlick()}},onResize:function(){if(this.slickActive){this.refreshSlick()}}});$.fn.tailorSimpleCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSimpleCarousel");if(!instance){$.data(this,"tailorSimpleCarousel",new Carousel(this,options,callbacks))}})}},{}],20:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Carousel;Carousel=Components.create({getDefaults:function(){return{items:".tailor-carousel__item",prevArrow:'',nextArrow:'',adaptiveHeight:false,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,initialSlide:0,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:false,infinite:false}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.slickAt(0,this.addEventListeners)},slickAt:function(index,callback){this.querySelectors();var numberItems=this.$items.length;if(!numberItems){return}index=Math.min(index,numberItems-1);if(index "+component.options.items);component.$dots=component.$el.children(".slick-dots").find(" > li");component.$dots.on("click",function(e){var $dot=$(e.currentTarget);component.currentSlide=$dot.data("id");component.$wrap.slick("slickGoTo",$dot.index());e.preventDefault()});if(!component.currentSlide){var $activeSlide=component.$items.filter(function(){return this.classList.contains("slick-current")});component.currentSlide=$activeSlide.length?$activeSlide.id:component.$items[0].id}},updateDots:function(index){this.$dots.each(function(i,el){if(index==i){el.classList.add("slick-active")}else{el.classList.remove("slick-active")}});this.$dots.toggle(this.$dots.length/this.options.slidesToShow>1)},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onBeforeRefresh:function(){this.unSlick()},onRefresh:function(){this.refreshSlick()},onJSRefresh:function(){this.refreshSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onAddChild:function(){this.refreshSlick()},onRemoveChild:function(e,childView){childView.$el.detach();this.refreshSlick()},onBeforeReadyChild:function(e,childView){this.unSlick()},onReadyChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeReorderChild:function(){this.unSlick()},onReorderChild:function(e,cid,index,oldIndex){this.querySelectors();this.slickAt(index)},onBeforeRefreshChild:function(){this.unSlick()},onRefreshChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeJSRefreshChild:function(){this.unSlick()},onJSRefreshChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeDestroyChild:function(){this.unSlick()},onDestroyChild:function(e,childView){var index=childView.$el.index();childView.$el.remove();this.slickAt(index)},onAddDescendant:function(){this.refreshSlick()},onRemoveDescendant:function(){this.refreshSlick()},onReadyDescendant:function(){this.refreshSlick()},onRefreshDescendant:function(){this.refreshSlick()},onJSRefreshDescendant:function(){this.refreshSlick()},onDestroyDescendant:function(){this.refreshSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorCarousel");if(!instance){$.data(this,"tailorCarousel",new Carousel(this,options,callbacks))}})}},{}],21:[function(require,module,exports){var ElementCollection=Backbone.Collection.extend({comparator:"order",model:function(attrs,options){var Model=Tailor.lookup(attrs.tag,attrs.type,"Models");return new Model(attrs,options)},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"change:parent",this.onChangeParent);this.listenTo(this,"add",this.onAdd);this.listenTo(this,"destroy",this.onDestroy);this.listenTo(this,"container:collapse",this.onCollapse);this.listenTo(this,"reset",this.onReset)},getElementDefinitions:function(){return this.library||app.channel.request("sidebar:library")},applyDefaults:function(model){if(model instanceof Backbone.Model){model=model.toJSON()}var item=this.getElementDefinitions().findWhere({tag:model.tag});var defaults={label:item.get("label"),type:item.get("type")};var child=item.get("child");if(child){defaults.child=child}var childViewContainer=item.get("child_container");if(childViewContainer){defaults.child_container=childViewContainer}model.atts=model.atts||{};_.each(item.get("settings"),function(setting){if(!_.isEmpty(setting["value"])&&!model.atts.hasOwnProperty(setting["id"])){model.atts[setting["id"]]=setting["value"]}});return _.extend(model,defaults)},getParent:function(model){return this.findWhere({id:model.get("parent")})},getChildren:function(model){return this.where({parent:model.get("id")})},getSiblings:function(model){return this.where({parent:model.get("parent")})},hasSelectedParent:function(model){var selected=app.channel.request("canvas:element:selected");if(!selected||model===selected){return false}var parentId=model.get("parent");var parent=this.findWhere({id:parentId});while("undefined"!==typeof parent){if(selected===parent){return true}parentId=parent.get("parent");parent=this.get(parentId)}return false},onChangeParent:function(model){var parent=this.get(model.get("parent"));var previousParent=this.get(model.previous("parent"));this.sort({silent:true});this._checkParent(previousParent);if("tailor_column"===model.get("tag")){this._reBalanceColumns(parent);this._reBalanceColumns(previousParent)}},onAdd:function(model,collection,options){if("tailor_column"==model.get("tag")){this._reBalanceColumns(this.get(model.get("parent")))}},onDestroy:function(model){var parent=this.get(model.get("parent"));this._checkParent(parent);var children=this.where({parent:model.get("id")});if(children.length){_.each(children,function(child){child.trigger("destroy",child,this)},this)}if(parent&&"tailor_column"===model.get("tag")){this._reBalanceColumns(parent)}if(0===this.length){this.onEmpty()}},onReset:function(){if(0===this.length){this.onEmpty()}},onEmpty:function(){var section=this.createSection(0);this.create([{tag:"tailor_content",atts:{},parent:section.get("id"),order:0}])},onCollapse:function(model,children){var parentId=model.get("parent");_.each(children,function(child){child.set("parent",parentId)},this)},add:function(models,options){if(_.isArray(models)){_.each(models,this.applyDefaults.bind(this))}else{this.applyDefaults(models)}return this.set(models,_.extend({merge:false},options,{add:true,remove:false}))},create:function(models,options){options=options||{};return this.add(models,options)},createSection:function(order){return _.first(this.create([{tag:"tailor_section",order:order}],{at:order}))},createRow:function(parentId,order){var row=_.first(this.create([{tag:"tailor_row",parent:parentId,order:order}],{}));return this.create([{tag:"tailor_column",atts:{width:"50%"},parent:row.get("id"),order:0},{tag:"tailor_column",atts:{width:"50%"},parent:row.get("id"),order:1}])},createColumn:function(parentId,order){return _.first(this.create([{tag:"tailor_column",parent:parentId,order:order}]))},createContainer:function(model,parentId,order,descendants){var tag=model.get("tag");var container=_.first(this.create([{tag:tag,parent:parentId,order:order}],{at:order,silent:true}));var childTag=model.get("child");var children=this.create([{tag:childTag,parent:container.get("id"),order:0},{tag:childTag,parent:container.get("id"),order:1}],{silent:true});if(descendants){_.first(descendants).set("parent",_.first(children).get("id"),{silent:true});_.last(descendants).set("parent",_.last(children).get("id"),{silent:true})}this.trigger("add",container,this,{})},createWrapper:function(tag,parentId,order,child){var wrapper=_.first(this.create([{tag:tag,parent:parentId,order:order}],{silent:true}));if("undefined"==typeof child){this.create([{tag:"tailor_content",parent:wrapper.get("id"),order:0}],{silent:true})}this.trigger("add",wrapper,this,{});if("undefined"!=typeof child){this.insertChild(child,wrapper)}return wrapper},createChild:function(model){var child=_.first(this.create([{tag:model.get("child"),parent:model.get("id"),order:this.getChildren(model).length}],{silent:true}));this.create([{tag:"tailor_content",parent:child.get("id"),order:0}],{silent:true});this.trigger("add",child,this,{});return child},insertChild:function(child,parent){if(!child){return}if(child.get("parent")!==parent.get("id")){child.trigger("remove:child")}parent.trigger("insert",child);child.trigger("add:child");child.set("parent",parent.get("id"))},_reBalanceColumns:function(model){var children=this.where({parent:model.get("id")});var numberChildren=children.length;_.each(children,function(child){var atts=_.clone(child.get("atts"));atts["width"]=Math.round(parseFloat(1/numberChildren)*1e3)/10+"%";delete atts["width_tablet"];delete atts["width_mobile"];child.set("atts",atts,{silent:true});child.trigger("change:width",child,atts)},this)},_checkParent:function(model){if(!model){return}if("container"==model.get("type")){this._checkCollapsibleContainer(model)}this._checkChildren(model)},_checkChildren:function(model){var children=this.where({parent:model.get("id")});if(0===children.length){model.trigger("destroy",model)}},_checkCollapsibleContainer:function(model){var childTag=this.getElementDefinitions().findWhere({tag:model.get("tag")}).get("child");var containerId=model.get("id");var children=this.filter(function(element){return containerId===element.get("parent")&&childTag===element.get("tag")});if(0===children.length){model.trigger("container:collapse",model,this.where({parent:containerId}))}else if(1===children.length){var child=_.first(children);if("tailor_row"===model.get("tag")){child.trigger("container:collapse",child,this.where({parent:child.get("id")}))}}}});module.exports=ElementCollection},{}],22:[function(require,module,exports){var ChildModel=require("./../element-child"),ColumnModel;ColumnModel=ChildModel.extend({validTarget:function(that,region){if(_.contains(["tailor_section","tailor_row"],that.get("tag"))||!_.contains(["left","right"],region)){return false}if("child"==that.get("type")&&that.get("tag")!=this.get("tag")){return false}var siblings=this.collection.getSiblings(this);return that.get("parent")==this.get("parent")||siblings.length<6}});module.exports=ColumnModel},{"./../element-child":28}],23:[function(require,module,exports){var ChildModel=require("./../element-child"),GridItemModel;GridItemModel=ChildModel.extend({validTarget:function(that,region){if("tailor_section"==that.get("tag")||_.contains(["top","bottom","center"],region)){return false}var parent=this.collection.getParent(this);if(parent.get("tag")==that.get("tag")){return false}return that.get("tag")==this.get("tag")}});module.exports=GridItemModel},{"./../element-child":28}],24:[function(require,module,exports){var ContainerModel=require("./../element-container"),CarouselModel;CarouselModel=ContainerModel.extend({createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();var $navigation=view.$el.find(".slick-dots").detach();this.appendTemplate(id,view);$childViewContainer.append($children);$navigation.insertAfter($childViewContainer);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=CarouselModel},{"./../element-container":30}],25:[function(require,module,exports){var ContainerModel=require("./../element-container"),RowModel;RowModel=ContainerModel.extend({validTarget:function(that,region){if("child"==that.get("type")||"tailor_section"==that.get("tag")||"center"==region){return false}return _.contains(["top","bottom"],region)&&"tailor_column"!=that.get("tag")}});module.exports=RowModel},{"./../element-container":30}],26:[function(require,module,exports){var ContainerModel=require("./../element-container"),TabsModel;TabsModel=ContainerModel.extend({createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();var $navigation=view.$el.find(".tailor-tabs__navigation");var $navigationItems=$navigation.children().detach();this.appendTemplate(id,view);$childViewContainer.append($children);$navigation.append($navigationItems);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=TabsModel},{"./../element-container":30}],27:[function(require,module,exports){var Model;Backbone.Model.prototype.set=_.wrap(Backbone.Model.prototype.set,function(oldSet,key,val,options){if(key==null)return this;var attrs;if(typeof key==="object"){attrs=key;options=val}else{(attrs={})[key]=val}options||(options={});var ret=oldSet.call(this,attrs,options);if(this._tracking){_.each(attrs,_.bind(function(val,key){if(_.isEqual(this._original[key],val)){delete this._unsaved[key]}else{this._unsaved[key]=val}},this))}return ret});Model=Backbone.Model.extend({_tracking:false,_original:{},_unsaved:{},defaults:function(){return{id:this.cid,tag:"",label:"",atts:{},parent:"",order:0,collection:"element"}},isTracking:function(){return this._tracking},startTracking:function(){this._tracking=true;this.resetTracking();return this},stopTracking:function(){this._tracking=false;this._original={};this._unsaved={};return this},resetTracking:function(){this._original=_.clone(this.attributes);this._unsaved={};return this},resetAttributes:function(){if(!this._tracking){return}this.attributes=this._original;this.resetTracking();this.trigger("change:atts",this,this.get("atts"));return this},toShortcode:function(){var tag=this.get("tag");var atts=this.get("atts");var content="";var shortcode="["+tag;_.each(atts,function(attr,id){if(attr){if("content"===id){content=attr}else{if(_.isNumber(id)){if(/\s/.test(attr)){shortcode+=' "'+attr+'"'}else{shortcode+=" "+attr}}else{shortcode+=" "+id+'="'+attr+'"'}}}},this);return shortcode+"]"+content+"[/"+tag+"]"},insertBefore:function(view){this.trigger("remove:child");this.trigger("insert:before",view);this.trigger("add:child");this.set("parent",view.model.get("parent"))},insertAfter:function(view){this.trigger("remove:child");this.trigger("insert:after",view);this.trigger("add:child");this.set("parent",view.model.get("parent"))},columnBefore:function(view){var model=view.model;var parent=model.get("parent");if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(parent,model.get("order")-1);this.collection.insertChild(this,column)}else{var columns=this.collection.createRow(parent,model.get("order"));this.collection.insertChild(this,_.first(columns));this.collection.insertChild(model,_.last(columns))}},columnAfter:function(view){var model=view.model;var parent=model.get("parent");if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(parent,model.get("order"));this.collection.insertChild(this,column)}else{var columns=this.collection.createRow(parent,model.get("order"));this.collection.insertChild(model,_.first(columns));this.collection.insertChild(this,_.last(columns))}},beforeCopyElement:function(view){var el=view.el;view.triggerAll("before:element:copy",view);el.classList.remove("is-dragging");el.classList.remove("is-hovering");el.classList.remove("is-selected");el.classList.remove("is-editing")},appendTemplate:function(id,view){var oldId=view.model.get("id");var template=document.createElement("script");template.setAttribute("type","text/html");template.id="tmpl-tailor-"+id;template.innerHTML=view.el.outerHTML.replace(oldId,id);document.body.appendChild(template)},afterCopyElement:function(id,view){var oldId=view.model.get("id");view.$el.trigger("element:copy",view);app.channel.trigger("css:copy",oldId,id)}});module.exports=Model},{}],28:[function(require,module,exports){var CompositeModel=require("./element-composite"),ChildModel;ChildModel=CompositeModel.extend({validTarget:function(that,region){if("tailor_section"==that.get("tag")||_.contains(["left","right","center"],region)){return false}var parent=this.collection.getParent(this);if(parent.get("tag")==that.get("tag")){return false}return that.get("tag")==this.get("tag")},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.insertBefore);this.listenTo(this,"element:move:right",this.insertAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyBefore);this.listenTo(this,"element:copy:right",this.copyAfter)}});module.exports=ChildModel},{"./element-composite":29}],29:[function(require,module,exports){var BaseModel=require("./element-base"),CompositeModel;CompositeModel=BaseModel.extend({cloneContainer:function(sourceView,parent,index){var collection=this.collection;var clone=sourceView.model.clone();clone.set("id",clone.cid);clone.set("parent",parent);clone.set("order",index);this.createTemplate(clone.cid,sourceView);var clonedChildren=this.cloneChildren(sourceView.children,clone,[]);collection.add(clonedChildren,{silent:true});collection.add(clone);sourceView.triggerMethod("element:refresh")},cloneChildren:function(childViews,parent,clones){if(childViews.length){childViews.each(function(childView){var clone=childView.model.clone();clone.set("id",clone.cid);clone.set("parent",parent.get("id"));clone.createTemplate(clone.cid,childView);clones.push(clone);if(childView.children){this.cloneChildren(childView.children,clone,clones)}},this)}return clones},copyBefore:function(targetView,sourceView){this.cloneContainer(sourceView,targetView.model.get("parent"),targetView.model.get("order")-1)},copyAfter:function(targetView,sourceView){this.cloneContainer(sourceView,targetView.model.get("parent"),targetView.model.get("order"))},copyColumnBefore:function(targetView,sourceView){var parent=targetView.model.get("parent");if("tailor_column"===targetView.model.get("tag")){var column=this.collection.createColumn(parent,targetView.model.get("order")-1);this.cloneContainer(sourceView,column.get("id"),0)}else{var columns=this.collection.createRow(parent,targetView.model.get("order"));this.collection.insertChild(targetView.model,_.last(columns));this.cloneContainer(sourceView,_.first(columns).get("id"),0)}},copyColumnAfter:function(targetView,sourceView){var parent=targetView.model.get("parent");if("tailor_column"===targetView.model.get("tag")){var column=this.collection.createColumn(parent,targetView.model.get("order"));this.cloneContainer(sourceView,column.get("id"),0)}else{var columns=this.collection.createRow(parent,targetView.model.get("order"));this.collection.insertChild(targetView.model,_.first(columns));this.cloneContainer(sourceView,_.last(columns).get("id"),0)}},createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();this.appendTemplate(id,view);$childViewContainer.append($children);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=CompositeModel},{"./element-base":27}],30:[function(require,module,exports){var CompositeModel=require("./element-composite"),ContainerModel;ContainerModel=CompositeModel.extend({validTarget:function(that,region){if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("center"==region){return"container"!=that.get("type")}if(_.contains(["wrapper","child"],parent.get("type"))){if(_.contains(["top","bottom"],region)){return _.contains(["tailor_section","tailor_column"],parent.get("tag"))||!_.contains(["container","wrapper","child"],that.get("type"))}return"tailor_section"==parent.get("tag")||!_.contains(["left","right"],region)}return"container"!=that.get("type")},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter)}});module.exports=ContainerModel},{"./element-composite":29}],31:[function(require,module,exports){var CompositeModel=require("./element-composite"),WrapperModel;WrapperModel=CompositeModel.extend({validTarget:function(that,region){if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))||"center"==region){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("child"==parent.get("type")&&"tailor_column"!=parent.get("tag")){return"container"!=that.get("type")&&!_.contains(["left","right"],region)}if(_.contains(["container","wrapper","child"],parent.get("type"))){return"tailor_section"==parent.get("tag")||!_.contains(["left","right"],region)}return true},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter);this.listenTo(this,"element:move:center",this.createChild);this.listenTo(this,"element:copy:center",this.copyChild)},createChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;this.createTemplate(sourceView.model.get("id"),sourceView);this.collection.createWrapper(childTag,id,numberChildren,sourceView.model)},copyChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;var wrapper=this.collection.createWrapper(childTag,id,numberChildren,false);this.cloneContainer(sourceView,wrapper.get("id"),0)}});module.exports=WrapperModel},{"./element-composite":29}],32:[function(require,module,exports){var BaseModel=require("./element-base"),ElementModel;ElementModel=BaseModel.extend({validTarget:function(that,region,threshold){if(threshold<20){return false}if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))||"center"==region){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("child"==parent.get("type")&&"tailor_column"!=parent.get("tag")){return"container"!=that.get("type")&&!_.contains(["left","right"],region)}if(_.contains(["wrapper","child"],parent.get("type"))){if(_.contains(["top","bottom"],region)){return _.contains(["tailor_section","tailor_column"],parent.get("tag"))||!_.contains(["container","wrapper","child"],that.get("type"))}return"tailor_section"==parent.get("tag")||_.contains(["left","right"],region)}return true},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter);this.listenTo(this,"element:move:center",this.createChild);this.listenTo(this,"element:copy:center",this.copyChild)},copyBefore:function(targetView,sourceView){var clone=sourceView.model.clone();var index=targetView.model.get("order")-1;clone.set("id",clone.cid);clone.set("parent",targetView.model.get("parent"));clone.set("order",index);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},copyAfter:function(targetView,sourceView){var clone=sourceView.model.clone();var index=targetView.model.get("order");clone.set("id",clone.cid);clone.set("parent",targetView.model.get("parent"));clone.set("order",index);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},copyColumnBefore:function(targetView,sourceView){var model=targetView.model;var clone=sourceView.model.clone();clone.set("id",clone.cid);this.createTemplate(clone.cid,sourceView);if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(model.get("parent"),model.get("order")-1);clone.set("parent",column.get("id"));this.collection.add(clone)}else{var columns=this.collection.createRow(model.get("parent"),model.get("order"));this.collection.insertChild(model,_.last(columns));clone.set("parent",_.first(columns).get("id"));this.collection.add(clone)}},copyColumnAfter:function(targetView,sourceView){var model=targetView.model;var clone=sourceView.model.clone(); -clone.set("id",clone.cid);this.createTemplate(clone.cid,sourceView);if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(model.get("parent"),model.get("order"));clone.set("parent",column.get("id"));this.collection.add(clone)}else{var columns=this.collection.createRow(model.get("parent"),model.get("order"));this.collection.insertChild(model,_.first(columns));clone.set("parent",_.last(columns).get("id"));this.collection.add(clone)}},createChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;this.appendTemplate(sourceView.model.get("id"),sourceView);this.collection.createWrapper(childTag,id,numberChildren,sourceView.model)},copyChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;var wrapper=this.collection.createWrapper(childTag,id,numberChildren,false);var clone=sourceView.model.clone();clone.set("id",clone.cid);clone.set("parent",wrapper.get("id"));clone.set("order",0);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);this.appendTemplate(id,view);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=ElementModel},{"./element-base":27}],33:[function(require,module,exports){var WrapperModel=require("./../element-wrapper"),SectionModel;SectionModel=WrapperModel.extend({validTarget:function(that,region){return"tailor_section"==that.get("tag")&&!_.contains(["left","right","center"],region)}});module.exports=SectionModel},{"./../element-wrapper":31}],34:[function(require,module,exports){var CanvasRegion=Backbone.Marionette.Region.extend({initialize:function(){this.listenTo(app.channel,"canvas:dragstart",this.onDragStart);this.listenTo(app.channel,"canvas:dragend",this.onDragEnd)},onDragStart:function(view,region,options){this.el.classList.add("is-active")},onDragEnd:function(view,region,options){this.el.classList.remove("is-active")}});module.exports=CanvasRegion},{}],35:[function(require,module,exports){var $=Backbone.$,$win=$(window),$doc=$(document),CanvasCollectionView=require("./show/canvas-view"),CanvasModule;CanvasModule=Marionette.Module.extend({onStart:function(){this._model=null;this._isDragging=false;this.collection=app.channel.request("canvas:elements");this.addEventListeners();this.showCanvas();app.channel.trigger("module:canvas:ready",this)},addEventListeners:function(){this.listenTo(app.channel,"canvas:dragstart",this.onDragStart);this.listenTo(app.channel,"canvas:dragover",this.onDragOver);this.listenTo(app.channel,"canvas:dragend",this.onDragEnd);this.listenTo(app.channel,"canvas:drop",this.onDrop);$doc.on("click dragover",this.reset.bind(this));$win.on("resize",this.reset.bind(this))},showCanvas:function(){app.canvasRegion.show(new CanvasCollectionView({collection:this.collection}))},onDragStart:function(e,view){var collection=view.model.collection;if("function"===typeof collection.hasSelectedParent&&collection.hasSelectedParent(view.model)){return}this._view=view;this._model=view.model;this._isDragging=true;view.el.classList.add("is-dragging");if("element"==view.model.get("collection")){var testVar=window.DataTransfer||window.Clipboard;if("setDragImage"in testVar.prototype){var dragImage=document.createElement("img");dragImage.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";e.dataTransfer.setDragImage(dragImage,0,0)}}e.dataTransfer.effectAllowed="copyMove";e.dataTransfer.setData("Text",this._model.cid);e.stopPropagation()},onDragOver:function(e,view){if(!this._isDragging){return}if(e.pageY){var scrollY=window.scrollY||document.documentElement.scrollTop;if(e.pageY-scrollY<40){window.scrollTo(0,scrollY-20)}else if(scrollY+window.innerHeight-e.pageY<40){window.scrollTo(0,scrollY+20)}}var action="element"===this._model.get("collection")&&e.shiftKey?"copy":"move";if("move"===action&&view.model===this._model){this.reset();e.stopPropagation();return}var region=this._getDropRegion(e,view);if(!view.model.validTarget(this._model,region)){return}e.dataTransfer.dropEffect=action;app.channel.trigger("canvas:guide",view,region);e.preventDefault();e.stopPropagation()},onDrop:function(e,view){if(!this._isDragging){return}var model=this._model;var region=this._getDropRegion(e,view);if(!view.model.validTarget(model,region)){return}var action;if("element"===model.get("collection")){action=e.shiftKey?"copy":"move";if("move"===action&&view.model===model){return}}else{action="add"}model.trigger("element:"+action+":"+region,view,this._view);app.channel.trigger("element:"+action,model);this.collection.sort({silent:true});e.preventDefault();e.stopPropagation()},onDragEnd:function(e,view){if(!this._isDragging){return}this._isDragging=false;this._view.el.classList.remove("is-dragging");this.reset()},reset:function(){app.channel.trigger("canvas:reset")},_getPoint:function(e){if(e.targetTouches){return{x:e.targetTouches[0].clientX,y:e.targetTouches[0].clientY}}return{x:e.clientX,y:e.clientY}},_getDropRegion:function(e,view){var point=this._getPoint(e);var rect=view.el.getBoundingClientRect();var width=rect.width/2;var height=rect.height/2;var top=rect.top+(rect.height-height)/2;var left=rect.left+(rect.width-width)/2;if(left<=point.x&&point.x<=left+width&&top<=point.y&&point.y<=top+height){return"center"}else{var x=(point.x-(rect.left+width))/width;var y=(point.y-(rect.top+height))/height;if(Math.abs(x)>Math.abs(y)){return x>0?"right":"left"}return y>0?"bottom":"top"}}});module.exports=CanvasModule},{"./show/canvas-view":36}],36:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({behaviors:{Container:{}},getChildView:function(){return Tailor.lookup("tailor_section","wrapper","Views")},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return!child.get("parent")},_updateIndices:function(view,increment,index){if(increment){view._index=index;view.model._changing=false;view.model.set("order",index)}this.children.each(function(laterView){if(laterView._index>=view._index){laterView._index+=increment?1:-1;laterView.model.set("order",laterView._index)}},this)},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}}})},{}],37:[function(require,module,exports){var Stylesheet=require("./stylesheet"),CSSModule;CSSModule=Marionette.Module.extend({onStart:function(options){this.stylesheets=[];this.collection=app.channel.request("canvas:elements");this.createSheets(options.mediaQueries||{});this.addRules(options.cssRules||{});this.addEventListeners();app.channel.trigger("module:css:ready",this)},addEventListeners:function(){this.listenTo(app.channel,"css:add",this.addRules);this.listenTo(app.channel,"css:delete",this.deleteRules);this.listenTo(app.channel,"css:update",this.updateRules);this.listenTo(app.channel,"css:copy",this.copyRules);this.listenTo(app.channel,"css:clear",this.clearRules);this.listenTo(this.collection,"destroy",this.onDestroy)},createSheet:function(id,min,max){var media="only screen";if(min){media+=" and (min-width: "+min+")"}if(max){media+=" and (max-width: "+max+")"}return new Stylesheet(id,media)},createSheets:function(mediaQueries){_.each(mediaQueries,function(atts,id){if(!_.isEmpty(atts.min)){if(!_.isEmpty(atts.max)){this.stylesheets[id+"-up"]=this.createSheet(id+"-up",atts.min);this.stylesheets[id]=this.createSheet(id,atts.min,atts.max)}else{this.stylesheets[id]=this.createSheet(id,atts.min)}}else{if(!_.isEmpty(atts.max)){this.stylesheets[id]=this.createSheet(id,null,atts.max)}else{this.stylesheets[id]=this.createSheet(id)}}},this);app.channel.trigger("module:css:stylesheets:ready",this)},getSheet:function(id){if(this.stylesheets.hasOwnProperty(id)){return this.stylesheets[id]}return false},addRules:function(cssRules){for(var queryId in cssRules){if(cssRules.hasOwnProperty(queryId)){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].addRules(cssRules[queryId])}}}},clearRules:function(){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].clearRules()}}},copyRules:function(elementId,newElementId){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){var rules=this.stylesheets[queryId].getRules(elementId);if(rules.length){for(var rule in rules){if(rules.hasOwnProperty(rule)){rules[rule].selectors=rules[rule].selectors.replace(new RegExp(elementId,"g"),newElementId)}}var rulesSet={};rulesSet[queryId]={};rulesSet[queryId][newElementId]=rules;this.addRules(rulesSet)}}}},deleteRules:function(elementId,settingId){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].deleteRules(elementId,settingId)}}},updateRules:function(elementId,cssRules){this.deleteRules(elementId);this.addRules(cssRules)},onReset:function(){this.clearRules()},onDestroy:function(model){this.deleteRules(model.get("id"))}});module.exports=CSSModule},{"./stylesheet":38}],38:[function(require,module,exports){function Stylesheet(id,media){this.id=id;this.initialize(media)}Stylesheet.prototype={initialize:function(media){this.stylesheet=this.createStylesheet(media);this.sheet=this.stylesheet.sheet;this.lookup=[]},createStylesheet:function(media){var style=document.createElement("style");style.appendChild(document.createTextNode(""));media=media||"screen";style.setAttribute("media",media);style.setAttribute("id","tailor-"+this.id);document.head.appendChild(style);return style},addRules:function(ruleSet){for(var elementId in ruleSet){if(ruleSet.hasOwnProperty(elementId)){this.lookup=this.lookup||[];for(var i in ruleSet[elementId]){if(ruleSet[elementId].hasOwnProperty(i)){this.addRule(elementId,ruleSet[elementId][i])}}}}},addRule:function(elementId,rule){if(this.checkRule(rule)){var selectors=Tailor.CSS.parseSelectors(rule["selectors"],elementId);var declarations=Tailor.CSS.parseDeclarations(rule["declarations"]);if(!_.isEmpty(declarations)){var settingId=rule["setting"];Tailor.CSS.addRule(this.sheet,selectors,declarations,this.lookup.length);this.lookup.push({elementId:elementId,settingId:settingId})}}},checkRule:function(rule){return _.has(rule,"selectors")&&_.has(rule,"declarations")&&_.has(rule,"setting")},getRules:function(elementId){var rules=[];for(var i=0;i-1){rules.push({selectors:rule.selectorText,declarations:rule.style.cssText,setting:this.lookup[i]["settingId"]||""})}}}return rules},deleteRules:function(elementId,settingId){for(var i=0;i1){module.collection.add(parents,{at:index+1})}else{parents[0].parent=parent;parents[0].order=index;module.collection.add(parents)}app.channel.trigger("template:add",model)}canvas.classList.remove("is-loading")}})}};app.channel.on("template:load",api.loadTemplate);app.channel.trigger("module:templates:ready",this)}});module.exports=TemplateModule},{}],41:[function(require,module,exports){var SelectRegion=Backbone.Marionette.Region.extend({onShow:function(view,region,options){view._view.el.classList.add("is-selected")},onEmpty:function(view,region,options){view._view.el.classList.remove("is-selected")}});module.exports=SelectRegion},{}],42:[function(require,module,exports){var GuideView=Marionette.ItemView.extend({template:false,position:function(view,drop){var $el=view.$el;var offset=$el.offset();var parentOffset=this.$el.offsetParent().offset();this.el.style.visibility="visible";this.el.className="guide guide--"+drop+" guide--"+view.model.get("tag");this.el.style.left=offset.left-parentOffset.left+"px";this.el.style.top=offset.top-parentOffset.top+"px";this.el.style.width=$el.outerWidth()+"px";this.el.style.height=$el.outerHeight()+"px";this.el.style.opacity=1},reset:function(){this.el.style="";this.el.style.visibility="hidden";this.el.style.opacity=0}});module.exports=GuideView},{}],43:[function(require,module,exports){var SelectMenuItemView=Marionette.ItemView.extend({tagName:"div",className:"select__item",events:{click:"onClick"},getTemplate:function(){return _.template("<%= label %>")},onClick:function(e){if(0===this._index){this.triggerMethod("toggle")}else{this.model.trigger("select")}e.stopPropagation()}});module.exports=SelectMenuItemView},{}],44:[function(require,module,exports){var SelectMenuItemView=require("./select-menu-item"),SelectMenuView;SelectMenuView=Marionette.CompositeView.extend({className:"select",childView:SelectMenuItemView,childViewContainer:".select__menu",ui:{add:".js-add",edit:".js-edit",copy:".js-copy",delete:".js-delete"},events:{"click @ui.add":"addElement","click @ui.edit":"editElement","click @ui.copy":"copyElement","click @ui.delete":"deleteElement"},modelEvents:{destroy:"destroy"},childEvents:{toggle:"toggleMenu"},template:"#tmpl-tailor-tools-select",serializeData:function(){var data=Backbone.Marionette.CompositeView.prototype.serializeData.apply(this,arguments);data.type=this.model.get("type");data.siblings=this.collection.where({parent:this.model.get("parent")}).length;return data},initialize:function(options){this._view=options.view},_filteredSortedModels:function(){var models=[];var model=this.model;while("undefined"!==typeof model){models.push(model);model=this.collection.get(model.get("parent"))}return models},onDomRefresh:function(){var thisRect=this.el.parentNode.getBoundingClientRect();var thatRect=this._view.el.getBoundingClientRect();var style=getComputedStyle(this._view.el,null);var borderTop=parseInt(style.getPropertyValue("border-top-width"),10);var borderRight=parseInt(style.getPropertyValue("border-right-width"),10);var borderBottom=parseInt(style.getPropertyValue("border-bottom-width"),10);var borderLeft=parseInt(style.getPropertyValue("border-left-width"),10);var left=Math.round(parseFloat(thatRect.left))+borderLeft;var right=Math.min(window.innerWidth+1,Math.round(thatRect.right)-borderRight);var width=right-left;this.el.style.top=Math.round(parseFloat(thatRect.top-parseFloat(thisRect.top)))+borderTop+"px";this.el.style.left=left-thisRect.left+"px";this.el.style.width=width+"px";this.el.style.height=Math.round(parseFloat(thatRect.height))-borderTop-borderBottom+"px";var controls=this.el.querySelector(".select__controls");var menu=this.el.querySelector(".select__menu");if(menu&&controls){var menuRect=menu.getBoundingClientRect();var controlsRect=controls.getBoundingClientRect();if(menuRect.width+controlsRect.width>parseInt(this.el.style.width,10)){this.el.classList.add("is-minimal")}}},addElement:function(){var child=this.model.collection.createChild(this.model);child.set("collection","library",{silent:true});app.channel.trigger("element:add",child)},editElement:function(){app.channel.trigger("modal:open",this.model)},copyElement:function(){this.model.copyAfter(this._view,this._view);app.channel.trigger("element:copy",this.model)},deleteElement:function(){this.model.trigger("destroy",this.model);app.channel.trigger("element:delete",this.model)},toggleMenu:function(){this.$el.toggleClass("is-expanded")}});module.exports=SelectMenuView},{"./select-menu-item":43}],45:[function(require,module,exports){var GuideView=require("./show/guide"),SelectorView=require("./show/select-menu"),ToolsModule;ToolsModule=Marionette.Module.extend({onStart:function(){var guide=new GuideView({el:"#guide"}).render();var api={positionGuide:function(view,drop){guide.position(view,drop)},selectElement:function(view){app.selectRegion.show(new SelectorView({model:view.model,collection:app.channel.request("canvas:elements"),view:view}))},resetGuide:function(){guide.reset();app.selectRegion.empty()},getSelectedElement:function(){var select=app.selectRegion.currentView;return select?select.model:null}};this.listenTo(app.channel,"canvas:guide",api.positionGuide);this.listenTo(app.channel,"canvas:select",api.selectElement);this.listenTo(app.channel,"canvas:reset",api.resetGuide);this.listenTo(app.channel,"element:refresh:template",api.resetGuide);app.channel.reply("canvas:element:selected",api.getSelectedElement);app.channel.trigger("module:tools:ready",this)}});module.exports=ToolsModule},{"./show/guide":42,"./show/select-menu":44}],46:[function(require,module,exports){require("./preview/helpers");require("./preview/behaviors");require("./preview/css")},{"./preview/behaviors":47,"./preview/css":48,"./preview/helpers":49}],47:[function(require,module,exports){(function($,app,SettingAPI,ElementAPI){ElementAPI.onRender("tailor_carousel",function(atts,model){var carousel=this;var options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:false,fade:"1"==atts.fade&&"1"==atts.items_per_row,slidesToShow:parseInt(atts.items_per_row,10)||1,adaptiveHeight:true};carousel.$el.tailorCarousel(options)});ElementAPI.onRender("tailor_content",function(atts,model){if(this.$el.find(".is-lightbox-image").length>0){this.$el.tailorLightbox({disableOn:function(){return $el.hasClass("is-selected")}})}});ElementAPI.onRender("tailor_gallery",function(atts,model){var $el=this.$el;var options;if("carousel"==atts.layout){options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:"1"==atts.dots,fade:"1"==atts.fade&&"1"==atts.items_per_row,infinite:false,slidesToShow:parseInt(atts.items_per_row,10)||2};$el.tailorSimpleCarousel(options)}else if("slideshow"==atts.layout){options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:false,fade:true,items:".tailor-slideshow__slide",adaptiveHeight:true,draggable:false,speed:250};if("1"==atts.thumbnails){options.customPaging=function(slider,i){var thumb=$(slider.$slides[i]).data("thumb");return''};options.dots=true}$el.tailorSlideshow(options)}else if(atts.masonry){$el.tailorMasonry()}if(this.el.classList.contains("is-lightbox-gallery")){$el.tailorLightbox({disableOn:function(){return $el.hasClass("is-selected")}})}});ElementAPI.onRender("tailor_map",function(atts,model){this.$el.tailorGoogleMap()});ElementAPI.onRender("tailor_posts",function(atts,model){var $el=this.$el;var options;if("carousel"==atts.layout){options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:"1"==atts.dots,fade:"1"==atts.fade&&"1"==atts.items_per_row,infinite:false,slidesToShow:parseInt(atts.items_per_row,10)||2};this.$el.tailorSimpleCarousel(options)}else if(atts.masonry){$el.tailorMasonry()}});ElementAPI.onRender("tailor_section",function(atts,model){if(atts["background_image"]&&atts["parallax"]&&1==atts["parallax"]){this.$el.tailorParallax()}});ElementAPI.onRender("tailor_tabs",function(atts,model){this.$el.tailorTabs()});ElementAPI.onRender("tailor_toggles",function(atts,model){this.$el.tailorToggles()})})(window.jQuery,window.app,window.Tailor.Api.Setting,window.Tailor.Api.Element)},{}],48:[function(require,module,exports){var $=Backbone.$,$win=$(window);(function(window,app,SettingAPI){var cssRules=window._pageRules||[];var cssCollection={_tailor_section_width:"",_tailor_column_spacing:"",_tailor_element_spacing:"",_tailor_page_css:""};var stylesheet=document.createElement("style");stylesheet.appendChild(document.createTextNode(""));stylesheet.setAttribute("media","screen");stylesheet.setAttribute("id","tailor-settings");document.head.appendChild(stylesheet);function getStyleValues(string){var values;if(-1!=string.indexOf(",")){values=string.split(",")}else{values=string.split("-")}if(2==values.length){values=_.object(["top","bottom"],values)}else if(4==values.length){values=_.object(["top","right","bottom","left"],values)}else{values={}}return values}function getMediaQuery(string){var query="";_.each(["_tablet","_mobile"],function(target){if(string.substring(string.length-target.length)==target){query=target.substring(1)}});return query}function generateCSS(settingId,value){cssCollection[settingId]="";value=_.isString(value)?value.trim():value;if(!_.isEmpty(value)){_.each(cssRules[settingId],function(rule){var selectors=Tailor.CSS.parseSelectors(rule.selectors);var declarations=Tailor.CSS.parseDeclarations(rule.declarations).replace(/\{\{(.*?)\}\}/g,value);cssCollection[settingId]+="\n"+selectors+" {"+declarations+"}"})}}function updateStylesheet(){var value="";for(var settingId in cssCollection){if(cssCollection.hasOwnProperty(settingId)){value+=cssCollection[settingId]}}stylesheet.innerHTML=value;$win.trigger("resize")}app.channel.on("module:css:stylesheets:ready",function(cssModule){var settings=app.channel.request("sidebar:settings");if(settings&&settings.length){settings.each(function(setting){var id=setting.get("id");var value=setting.get("value");value=_.isString(value)?value.trim():value;if(!_.isEmpty(value)&&cssCollection.hasOwnProperty(id)){if(cssRules.hasOwnProperty(id)){generateCSS(id,value)}else{cssCollection[id]=value}}})}updateStylesheet();var ids=["_tailor_section_width","_tailor_column_spacing","_tailor_element_spacing"];_.each(ids,function(settingId){if(cssRules.hasOwnProperty(settingId)){SettingAPI.onChange("sidebar:"+settingId,function(to,from){generateCSS(settingId,to);updateStylesheet()})}});SettingAPI.onChange("sidebar:_tailor_page_css",function(to,from){cssCollection["_tailor_page_css"]=to;updateStylesheet()});SettingAPI.onChange("sidebar:_post_title",function(to,from){$("h1, h2, h1 a, h2 a").each(function(){if(from==this.textContent){this.textContent=to}})});window.Tailor.Settings.overrides={"*":{},tailor_button:{color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"color","tailorValidateColor"],background_color:[[".tailor-button__inner"],"background-color","tailorValidateColor"],background_color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"background-color","tailorValidateColor"],border_color:[[".tailor-button__inner"],"border-color","tailorValidateColor"],border_color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"border-color","tailorValidateColor"],padding:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],padding_tablet:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],padding_mobile:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],margin:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],margin_tablet:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],margin_mobile:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],border_width:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_radius:[[".tailor-button__inner"],"border-radius","tailorValidateUnit"],shadow:[[".tailor-button__inner"],"box-shadow"]},tailor_card:{border_color:[["",".tailor-card__header"],"border-color","tailorValidateColor"],padding:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"],padding_tablet:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"],padding_mobile:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"]},tailor_carousel:{border_color:[["",".slick-dots"],"border-color","tailorValidateColor"]},tailor_grid:{border_color:[[".tailor-grid__item"],"border-color","tailorValidateColor"],border_style:function(to,from,model){return[{selectors:["&.tailor-grid--bordered .tailor-grid__item"],declarations:{"border-style":tailorValidateString(to)+"!important"}}]},border_width:function(to,from,model){return[{selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]},border_width_tablet:function(to,from,model){return[{media:"tablet",selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]},border_width_mobile:function(to,from,model){return[{media:"mobile",selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]}},tailor_grid_item:{padding:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"],padding_tablet:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"],padding_mobile:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"]},tailor_tabs:{border_color:[[".tailor-tabs__navigation-item",".tailor-tab"],"border-color","tailorValidateColor"]},tailor_tab:{background_color:[["&.tailor-tabs__navigation-item","&.tailor-tab"],"background-color","tailorValidateColor"],padding:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],padding_tablet:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],padding_mobile:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],border_width:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],background_repeat:[["&.tailor-tab"],"background-repeat","tailorValidateString"],background_position:[["&.tailor-tab"],"background-position","tailorValidateString"],background_size:[["&.tailor-tab"],"background-size","tailorValidateString"],background_attachment:[["&.tailor-tab"],"background-attachment","tailorValidateString"]},tailor_toggle:{border_color:[[".tailor-toggle__title",".tailor-toggle__body"],"border-color","tailorValidateColor"],border_style:[[".tailor-toggle__title",".tailor-toggle__body"],"border-style","tailorValidateString"],border_radius:[[".tailor-toggle__title",".tailor-toggle__body"],"border-radius","tailorValidateUnit"]},tailor_section:{max_width:[[".tailor-section__content"],"max-width","tailorValidateUnit"],max_width_tablet:[[".tailor-section__content"],"max-width","tailorValidateUnit"],max_width_mobile:[[".tailor-section__content"],"max-width","tailorValidateUnit"],min_height:[[".tailor-section__content"],"min-height","tailorValidateUnit"],min_height_tablet:[[".tailor-section__content"],"min-height","tailorValidateUnit"],min_height_mobile:[[".tailor-section__content"],"min-height","tailorValidateUnit"]}};function getDefinition(tag,id,definition){if(window.Tailor.Settings.overrides["*"].hasOwnProperty(id)){return window.Tailor.Settings.overrides["*"][id]}if(window.Tailor.Settings.overrides.hasOwnProperty(tag)&&window.Tailor.Settings.overrides[tag].hasOwnProperty(id)){return window.Tailor.Settings.overrides[tag][id]}return definition}function registerCallbacks(definitions){_.each(definitions,function(definition,id){SettingAPI.onChange("element:"+id,function(to,from,model){definition=getDefinition(model.get("tag"),id,definition);if("function"==typeof definition){return definition.call(this,to,from,model)}if(""==to){return[]}var rule={media:getMediaQuery(id),selectors:definition[0],declarations:{}};if("function"==typeof window[definition[2]]){rule.declarations[definition[1]]=window[definition[2]](to)}else{rule.declarations[definition[1]]=to}return[rule]})})}_.each(["horizontal_alignment","horizontal_alignment_tablet","horizontal_alignment_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){var media=getMediaQuery(id);if(""!=media){media="-"+media}if(from){this.el.classList.remove("u-text-"+from+media)}this.el.classList.add("u-text-"+to+media);if("tailor_list_item"==model.get("tag")){var atts=model.get("atts");if(!_.isEmpty(atts["graphic_background_color"])||!_.isEmpty(atts["graphic_background_color_hover"])){return[{selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==to?"0":"1em","padding-right":"right"==to?"1em":"0"}}]}else{return[{selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}}]}}})});_.each(["vertical_alignment","vertical_alignment_tablet","vertical_alignment_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){var media=getMediaQuery(id);if(""!==media){media="-"+media}if(from){this.el.classList.remove("u-align-"+from+media)}this.el.classList.add("u-align-"+to+media)})});_.each(["size","size_tablet","size_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){if("tailor_button"==model.get("tag")){var media=getMediaQuery(id);if(""!=media){media="-"+media}if(from){this.el.classList.remove("tailor-button--"+from+media)}this.el.classList.add("tailor-button--"+to+media)}})});registerCallbacks({width:[[],"width","tailorValidateUnit"],width_tablet:[[],"width","tailorValidateUnit"],width_mobile:[[],"width","tailorValidateUnit"],max_width:[[],"max-width","tailorValidateUnit"],max_width_tablet:[[],"max-width","tailorValidateUnit"],max_width_mobile:[[],"max-width","tailorValidateUnit"],min_height:[[],"min-height","tailorValidateUnit"],min_height_tablet:[[],"min-height","tailorValidateUnit"],min_height_mobile:[[],"min-height","tailorValidateUnit"], -min_item_height:[[".tailor-grid__item"],"min-height","tailorValidateUnit"]});registerCallbacks({color:[[],"color","tailorValidateColor"],color_hover:[[":hover"],"color","tailorValidateColor"],link_color:[["a"],"color","tailorValidateColor"],link_color_hover:[["a:hover"],"color","tailorValidateColor"],heading_color:[["h1","h2","h3","h4","h5","h6"],"color","tailorValidateColor"],background_color:function(to,from,model){var atts=model.get("atts");if(atts["background_image"]){return false}var definition=getDefinition(model.get("tag"),"background_color",[[],"background-color","tailorValidateColor"]);if("function"==typeof definition){return definition.call(this,to,from,model)}var rule={selectors:definition[0],declarations:{}};if("function"==typeof window[definition[2]]){rule.declarations[definition[1]]=window[definition[2]](to)}else{rule.declarations[definition[1]]=to}return[rule]},background_color_hover:[[":hover"],"background-color","tailorValidateColor"],border_color:[[],"border-color","tailorValidateColor"],border_color_hover:[[":hover"],"border-color","tailorValidateColor"],graphic_color:function(to,from,model){var tag=model.get("tag");if("tailor_box"==tag){return[{selectors:[".tailor-box__graphic"],declarations:{color:tailorValidateColor(to)}}]}else if("tailor_list_item"==tag){return[{selectors:[".tailor-list__graphic"],declarations:{color:tailorValidateColor(to)}}]}},graphic_color_hover:function(to,from,model){var tag=model.get("tag");if("tailor_box"==tag){return[{selectors:[".tailor-box__graphic:hover"],declarations:{color:tailorValidateColor(to)}}]}else if("tailor_list_item"==tag){return[{selectors:[".tailor-list__graphic:hover"],declarations:{color:tailorValidateColor(to)}}]}},graphic_background_color:function(to,from,model){var tag=model.get("tag");var rules=[];if("tailor_box"==tag){if(to){rules.push({selectors:[".tailor-box__graphic"],declarations:{"margin-bottom":"1em","background-color":tailorValidateColor(to),"text-align":"center"}})}}else if("tailor_list_item"==tag){var atts=model.get("atts");var alignment=atts["horizontal_alignment"];if(to){rules.push({selectors:[".tailor-list__graphic"],declarations:{"background-color":tailorValidateColor(to),"text-align":"center"}});rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{if(!_.isEmpty(atts["graphic_background_color_hover"])){rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}})}}}return rules},graphic_background_color_hover:function(to,from,model){var tag=model.get("tag");var rules=[];if("tailor_box"==tag){if(to){rules.push({selectors:[".tailor-box__graphic"],declarations:{"margin-bottom":"1em","text-align":"center"}});rules.push({selectors:[".tailor-box__graphic:hover"],declarations:{"background-color":tailorValidateColor(to)}})}}else if("tailor_list_item"==tag){var atts=model.get("atts");var alignment=atts["horizontal_alignment"];if(to){rules.push({selectors:[".tailor-list__graphic"],declarations:{"text-align":"center"}});rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}});rules.push({selectors:[".tailor-list__graphic:hover"],declarations:{"background-color":tailorValidateColor(to)}})}else{if(!_.isEmpty(atts["graphic_background_color"])){rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}})}}}return rules},title_color:[[".tailor-toggle__title"],"color","tailorValidateColor"],title_background_color:[[".tailor-toggle__title"],"background-color","tailorValidateColor"],navigation_color:function(to,from,model){return[{selectors:[".slick-active button:before"],declarations:{"background-color":tailorValidateColor(to)}},{selectors:[".slick-arrow:not( .slick-disabled )"],declarations:{color:tailorValidateColor(to)}}]}});registerCallbacks({class:function(to,from,model){var classNames;if(!_.isEmpty(from)){classNames=from.trim().split(/\s+(?!$)/g);for(var i in classNames){if(classNames.hasOwnProperty(i)){this.el.classList.remove(classNames[i])}}}if(!_.isEmpty(to)){classNames=to.trim().split(/\s+(?!$)/g);for(var j in classNames){if(classNames.hasOwnProperty(j)){this.el.classList.add(classNames[j])}}}},border_style:[[],"border-style","tailorValidateString"],border_radius:[[],"border-radius","tailorValidateUnit"],background_repeat:[[],"background-repeat","tailorValidateString"],background_position:[[],"background-position","tailorValidateString"],background_size:[[],"background-size","tailorValidateString"],background_attachment:[[],"background-attachment","tailorValidateString"],shadow:function(to,from,model){var definition=getDefinition(model.get("tag"),"shadow",[[]]);if("function"==typeof definition){return definition.call(this,to,from,model)}if(1==to){return[{selectors:definition[0],declarations:{"box-shadow":"0 2px 6px rgba(0, 0, 0, 0.1)"}}]}return[]}});_.each({margin:[[],"margin-{0}","tailorValidateUnit"],margin_tablet:[[],"margin-{0}","tailorValidateUnit"],margin_mobile:[[],"margin-{0}","tailorValidateUnit"],padding:[[],"padding-{0}","tailorValidateUnit"],padding_tablet:[[],"padding-{0}","tailorValidateUnit"],padding_mobile:[[],"padding-{0}","tailorValidateUnit"],border_width:[[],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[[],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[[],"border-{0}-width","tailorValidateUnit"]},function(definition,id){SettingAPI.onChange("element:"+id,function(to,from,model){definition=getDefinition(model.get("tag"),id,definition);if("function"==typeof definition){return definition.call(this,to,from,model)}var rules=[];var rule={media:getMediaQuery(id),selectors:definition[0],declarations:{}};_.each(getStyleValues(to),function(value,position){if("function"==typeof window[definition[3]]){rule.declarations[definition[1].replace("{0}",position)]=window[definition[2]](value)}else{rule.declarations[definition[1].replace("{0}",position)]=value}});if(_.keys(rule.declarations).length>0){rules.push(rule)}return rules})})})})(window,window.app,window.Tailor.Api.Setting)},{}],49:[function(require,module,exports){window.tailorValidateString=function(string){return string.replace(/[0-9]/g,"")};window.tailorValidateNumber=function(string){string=string.replace(/[^0-9,.]+/i,"");return!_.isEmpty(string)?string:"0"};window.tailorValidateColor=function(color){if(/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(color)){return color}if(isRGBA(color)){return color}return""};function isRGBA(color){return/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d*(?:\.\d+)?)\)$/.test(color)}window.tailorValidateUnit=function(value){var sign="";if("-"==value.charAt(0)){sign="-";value=value.substring(1)}return sign+tailorValidateNumber(value)+getUnit(value)};function getUnit(string){var map=["px","%","in","cm","mm","pt","pc","em","rem","ex","vw","vh"];var matches=string.match(new RegExp(map.join("|")));if(matches){return matches[0]}return"px"}},{}],50:[function(require,module,exports){var $=window.jQuery,$win=$(window),app=window.app,cssModule,callbacks={sidebar:[],element:[]};function checkQuery(query){if(!query||!_.contains(_.keys(cssModule.stylesheets),query)){query="all"}return query}var onSidebarChange=function(setting){var settingId=setting.get("id");if(_.isEmpty(callbacks["sidebar"][settingId])){return}_.each(callbacks["sidebar"][settingId],function(callback){callback.apply(window,[setting.get("value"),setting.previous("value")])});$win.trigger("resize")};var onElementChange=function(setting,view){var elementId=view.model.get("id");var settingId=setting.get("id");if(!callbacks["element"].hasOwnProperty(settingId)||0==callbacks["element"][settingId].length){return}if(1==callbacks["element"][settingId].length){cssModule.deleteRules(elementId,settingId)}var ruleSets={};var rules;_.each(callbacks["element"][settingId],function(callback){if("function"==typeof callback){rules=callback.apply(view,[setting.get("value"),setting.previous("value"),view.model]);if(false===rules){view.model.trigger("change:atts",view.model,view.model.get("atts"))}else if(_.isArray(rules)&&rules.length>0){for(var rule in rules){if(rules.hasOwnProperty(rule)){if(!rules[rule].hasOwnProperty("selectors")||!rules[rule].hasOwnProperty("declarations")){continue}var query=checkQuery(rules[rule].media);ruleSets[query]=ruleSets[query]||{};ruleSets[query][elementId]=ruleSets[query][elementId]||[];if(_.keys(rules[rule].declarations).length>0){ruleSets[query][elementId].push({selectors:rules[rule].selectors,declarations:rules[rule].declarations,setting:rules[rule].setting||settingId})}}}cssModule.addRules(ruleSets)}}})};app.listenTo(app.channel,"sidebar:setting:change",onSidebarChange);app.listenTo(app.channel,"element:setting:change",onElementChange);app.channel.on("module:css:stylesheets:ready",function(module){cssModule=module});function registerCallback(type,id,callback){if("function"===typeof callback){callbacks[type][id]=callbacks[type][id]||[];callbacks[type][id].push(callback)}}module.exports={onChange:function(id,callback){var parts=id.split(":");if(parts.length>=2&&_.contains(["sidebar","element"],parts[0])){registerCallback(parts[0],parts[1],callback)}}}},{}],51:[function(require,module,exports){var DraggableBehaviors=Marionette.Behavior.extend({events:{dragstart:"onDragStart",dragend:"onDragEnd",drag:"onDrag"},onDragStart:function(e){app.channel.trigger("canvas:dragstart",e.originalEvent,this.view)},onDrag:function(e){app.channel.trigger("canvas:drag",e.originalEvent,this.view)},onDragEnd:function(e){app.channel.trigger("canvas:dragend",e.originalEvent,this.view)}});module.exports=DraggableBehaviors},{}],52:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],53:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],54:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],55:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],56:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],58:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],59:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},initialize:function(){var self=this;var initial=self.options.initial-1;if(initial<=0){initial=false}var accordionOverrideCallback=function(){};if(self.options.accordion){accordionOverrideCallback=self.allowMultiplePanesOpen}this.$el.accordion({header:".tailor-toggle .tailor-toggle__title",collapsible:true,active:initial,animate:self.options.speed,beforeActivate:accordionOverrideCallback})},allowMultiplePanesOpen:function(event,ui){if(ui.newHeader[0]){var currHeader=ui.newHeader;var currContent=currHeader.next(".ui-accordion-content")}else{var currHeader=ui.oldHeader;var currContent=currHeader.next(".ui-accordion-content")}var isPanelSelected=currHeader.attr("aria-selected")=="true";currHeader.toggleClass("ui-corner-all",isPanelSelected).toggleClass("accordion-header-active ui-state-active ui-corner-top",!isPanelSelected).attr("aria-selected",(!isPanelSelected).toString());currHeader.children(".ui-icon").toggleClass("ui-icon-triangle-1-e",isPanelSelected).toggleClass("ui-icon-triangle-1-s",!isPanelSelected);currContent.toggleClass("accordion-content-active",!isPanelSelected);if(isPanelSelected){currContent.slideUp()}else{currContent.slideDown()}return false}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],60:[function(require,module,exports){var $=jQuery,Ajax;Ajax={url:window.ajaxurl,post:function(action,data){return ajax.send({data:_.isObject(action)?action:_.extend(data||{},{action:action})})},send:function(action,options){if(_.isObject(action)){options=action}else{options=options||{};options.data=_.extend(options.data||{},{action:action,tailor:1})}options=_.defaults(options||{},{type:"POST",url:ajax.url,context:this});return $.Deferred(function(deferred){if(options.success){deferred.done(options.success)}var onError=options.error?options.error:ajax.onError;deferred.fail(onError);delete options.success;delete options.error;$.ajax(options).done(function(response){if(response==="1"||response===1){response={success:true}}if(_.isObject(response)&&!_.isUndefined(response.success)){deferred[response.success?"resolveWith":"rejectWith"](this,[response.data])}else{deferred.rejectWith(this,[response])}}).fail(function(){deferred.rejectWith(this,arguments)})}).promise()},onError:function(response){if(!Tailor.Notify){console.error(response);return}if(response&&response.hasOwnProperty("message")){ -Tailor.Notify(response.message)}else if("0"==response){Tailor.Notify(window._l10n.expired)}else if("-1"==response){Tailor.Notify(window._l10n.invalid)}else{Tailor.Notify(window._l10n.error)}}};window.ajax=Ajax;module.exports=Ajax},{}],61:[function(require,module,exports){var CSS={addRule:function(sheet,selector,declaration,index){if("insertRule"in sheet){sheet.insertRule(selector+" {"+declaration+"}",sheet.cssRules.length)}else if("addRule"in sheet){sheet.addRule(selector,declaration,sheet.cssRules.length)}},deleteRule:function(sheet,index){if("deleteRule"in sheet){sheet.deleteRule(index)}else if("removeRule"in sheet){sheet.removeRule(index)}},parseSelectors:function(selectors,elementId){if(_.isString(selectors)){return selectors}var elementClass=elementId?".tailor-"+elementId:"";var prefix=".tailor-ui ";if(!selectors.length){return prefix+elementClass}selectors=selectors.map(function(selector){if(selector.indexOf("&")>-1){selector=selector.replace("&",elementClass)}else{var firstCharacter=selector.charAt(0);if(":"==firstCharacter||"::"==firstCharacter){selector=elementClass+selector}else{selector=elementClass+" "+selector}}return prefix+selector});return selectors.join(",")},parseDeclarations:function(declarations){if(_.isString(declarations)){return declarations}var declaration="";_.each(declarations,function(value,property){declaration+=property+":"+value+";"});return declaration}};module.exports=CSS},{}],62:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;i'+'
    '+"
    ")},onResize:function(e){var columnView=this;var device=app.channel.request("sidebar:device");var setting="desktop"==device?"width":"width_"+device;var model=columnView.model;var nextModel=model.collection.findWhere({parent:model.get("parent"),order:model.get("order")+1});var atts=model.get("atts");var nextAtts=nextModel.get("atts");var width=parseFloat(atts[setting]||atts.width);var nextWidth=parseFloat(nextAtts[setting]||nextAtts.width);var columnsWidth=width+nextWidth;var column=columnView.el.getBoundingClientRect();var $first=$(''+width+"%");var $second=$(''+nextWidth+"%");$first.prependTo(columnView.$el);$second.prependTo(columnView.$el.next());function onResize(e){document.body.classList.add("is-resizing");document.body.style.cursor="col-resize";var columnWidth=Math.min(columnsWidth-10,Math.max(10,Math.round(parseFloat((e.clientX-column.left)/column.width*width)*10)/10));var nextColumnWidth=Math.round(parseFloat(columnsWidth-columnWidth)*10)/10;columnWidth+="%";nextColumnWidth+="%";$first.html(columnWidth);$second.html(nextColumnWidth);var atts=_.clone(model.get("atts"));var nextAtts=_.clone(nextModel.get("atts"));atts[setting]=columnWidth;nextAtts[setting]=nextColumnWidth;model.set("atts",atts,{silent:true});nextModel.set("atts",nextAtts,{silent:true});model.trigger("change:width",model,atts);nextModel.trigger("change:width",nextModel,nextAtts)}function onResizeEnd(){document.removeEventListener("mousemove",onResize,false);document.removeEventListener("mouseup",onResizeEnd,false);document.body.classList.remove("is-resizing");document.body.style.cursor="default";$first.remove();$second.remove();var atts=model.get("atts");if(width!=atts[setting]){app.channel.trigger("element:resize",model)}}document.addEventListener("mousemove",onResize,false);document.addEventListener("mouseup",onResizeEnd,false);app.channel.trigger("canvas:reset");return false},onChangeWidth:function(model,atts){this.updateCSS(model.get("id"),atts);this.triggerAll("element:refresh",this)},updateCSS:function(elementId,atts){var ruleSet={};var width=atts["width"];var tabletWidth=atts["width_tablet"]||atts["width"];var mobileWidth=atts["width_mobile"]||atts["width"];ruleSet["desktop"]={};ruleSet["desktop"][elementId]=[{selectors:[],declarations:{width:width},setting:"width"}];ruleSet["tablet"]={};ruleSet["tablet"][elementId]=[{selectors:[".mobile-columns &",".tablet-columns &"],declarations:{width:tabletWidth},setting:"width_tablet"}];ruleSet["mobile"]={};ruleSet["mobile"][elementId]=[{selectors:[".mobile-columns &"],declarations:{width:mobileWidth},setting:"width_mobile"}];cssModule.deleteRules(elementId,"width");cssModule.deleteRules(elementId,"width_tablet");cssModule.deleteRules(elementId,"width_mobile");cssModule.addRules(ruleSet)}});module.exports=ColumnView},{"./../element-container":17}],10:[function(require,module,exports){var ContainerView=require("./../element-container"),TabView;TabView=ContainerView.extend({onRenderTemplate:function(){this.el.draggable=false;this.el.id=this.model.cid}});module.exports=TabView},{"./../element-container":17}],11:[function(require,module,exports){var ContainerView=require("./../element-container"),CarouselNavigationView=require("./navigation/carousel-navigation"),CarouselView;CarouselView=ContainerView.extend({onBeforeRenderTemplate:function(){if(this.navigation){this.navigation.triggerMethod("destroy")}},onRenderTemplate:function(){this.navigation=new CarouselNavigationView({model:this.model,collection:this.collection,sort:false});this.$el.append(this.navigation.render().el)},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this);this.navigation.triggerMethod("destroy")}});module.exports=CarouselView},{"./../element-container":17,"./navigation/carousel-navigation":13}],12:[function(require,module,exports){module.exports=Marionette.ItemView.extend({tagName:"li",attributes:function(){return{"data-id":this.model.cid}},getTemplate:function(){return _.template('')}})},{}],13:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({tagName:"ul",className:"slick-dots",childView:require("./carousel-navigation-item"),events:{dragstart:"onDragStart"},onDragStart:function(e){app.channel.trigger("canvas:reset");e.stopPropagation()},onRender:function(){var view=this;this.sortable=new Sortable(view.el,{draggable:"li",animation:150,onUpdate:function(e){var cid=e.item.getAttribute("data-id");view.$el.trigger("before:navigation:reorder",[cid,e.newIndex,e.oldIndex]);view.$el.trigger("navigation:reorder",[cid,e.newIndex,e.oldIndex]);app.channel.trigger("navigation:reorder",view.model)}})},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return child.get("parent")===this.model.get("id")},onBeforeDestroy:function(){this.sortable.destroy()}})},{"./carousel-navigation-item":12}],14:[function(require,module,exports){module.exports=Marionette.ItemView.extend({tagName:"li",className:function(){return"tailor-tabs__navigation-item tailor-"+this.model.get("id")},modelEvents:{"change:atts":"onChangeAttributes"},attributes:function(){return{"data-id":this.model.cid}},getTemplate:function(){return _.template('<%= title || "Tab" %>')},serializeData:function(){var data=Marionette.ItemView.prototype.serializeData.apply(this,arguments);var atts=this.model.get("atts");data.title=atts.title;return data},onChangeAttributes:function(model,atts){this.el.innerHTML=atts.title||"Tab"}})},{}],15:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({childView:require("./tabs-navigation-item"),events:{dragstart:"onDragStart"},onDragStart:function(e){app.channel.trigger("canvas:reset");e.stopPropagation()},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return child.get("parent")===this.model.get("id")},onRender:function(){var view=this;this.sortable=new Sortable(view.el,{draggable:"li",animation:150,onUpdate:function(e){var cid=e.item.getAttribute("data-id");view.$el.trigger("before:navigation:reorder",[cid,e.newIndex,e.oldIndex]);view.$el.trigger("navigation:reorder",[cid,e.newIndex,e.oldIndex]);app.channel.trigger("navigation:reorder",view.model)}})},onBeforeDestroy:function(){this.sortable.destroy()}})},{"./tabs-navigation-item":14}],16:[function(require,module,exports){var ContainerView=require("./../element-container"),TabsNavigationView=require("./navigation/tabs-navigation"),TabsView;TabsView=ContainerView.extend({ui:{navigation:".tailor-tabs__navigation"},onBeforeRenderTemplate:function(){if(this.navigation){this.navigation.triggerMethod("destroy")}},onRenderTemplate:function(){this.navigation=new TabsNavigationView({el:this.ui.navigation,model:this.model,collection:this.collection,sort:false});this.navigation.render()},childRefreshed:function(childView){childView.el.id=childView.model.cid;childView.el.classList.add("is-active");this.triggerAll("element:child:refresh",childView)},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this);this.navigation.triggerMethod("destroy")}});module.exports=TabsView},{"./../element-container":17,"./navigation/tabs-navigation":15}],17:[function(require,module,exports){var CompositeView=Marionette.CompositeView.extend({behaviors:{Container:{},Draggable:{},Droppable:{},Editable:{},Movable:{}},modelEvents:{"change:atts":"onChangeAttributes","change:order":"onChangeOrder","change:parent":"onChangeParent","change:setting":"onChangeSetting"},childEvents:{"before:element:ready":"beforeChildElementReady","element:ready":"childElementReady","before:element:refresh":"beforeChildElementRefreshed","element:refresh":"childElementRefreshed","before:element:jsRefresh":"beforeChildElementJSRefreshed","element:jsRefresh":"childElementJSRefreshed","element:change:parent":"childElementChangeParent","element:change:order":"childElementChangeOrder","before:element:destroy":"beforeChildElementDestroyed","element:destroy":"childElementDestroyed"},events:{"before:element:ready":"stopEventPropagation","element:ready":"stopEventPropagation","before:element:refresh":"stopEventPropagation","element:refresh":"stopEventPropagation","before:element:copy":"stopEventPropagation","element:copy":"stopEventPropagation","element:child:change:parent":"onDescendantChangeParent","element:child:change:order":"onDescendantChangeOrder","before:element:destroy":"stopEventPropagation","element:destroy":"stopEventPropagation","element:child:add":"onDescendantAdded","element:child:remove":"onDescendantRemoved","before:element:child:ready":"onBeforeDescendantReady","element:child:ready":"onDescendantReady","before:element:child:refresh":"onBeforeDescendantRefreshed","element:child:refresh":"onDescendantRefreshed","before:element:child:jsRefresh":"onBeforeDescendantJSRefreshed","element:child:jsRefresh":"onDescendantJSRefreshed","before:element:child:destroy":"onBeforeDescendantDestroyed","element:child:destroy":"onDescendantDestroyed","before:navigation:reorder":"stopEventPropagation","navigation:reorder":"onReorder"},onReorder:function(e,cid,index,oldIndex){var view=this.children.findByModelCid(cid);var otherView=this.children.find(function(childView){return childView.model.get("order")==index});if(oldIndex-index<0){view.$el.insertAfter(otherView.$el)}else{view.$el.insertBefore(otherView.$el)}this.children.each(function(childView){var childIndex=childView.$el.index();childView._index=childIndex;childView.model.set("order",childIndex)});view.model.collection.sort();e.stopPropagation()},onChangeAttributes:_.debounce(function(model,atts){model=this.model.toJSON();model.atts=atts?atts:{};var view=this;view.el.classList.add("is-rendering");window.ajax.send("tailor_render",{data:{model:JSON.stringify(model),nonce:window._nonces.render},success:function(response){view.updateTemplate(response.html);var id=view.model.get("id");app.channel.trigger("css:update",id,response.css)},error:function(response){view.updateTemplate('

    The template for '+view.cid+" could not be refreshed

    ");console.log(response)},complete:function(){var isEditing=view.$el.hasClass("is-editing");var isSelected=view.$el.hasClass("is-selected");view.$el.removeClass("is-rendering");view.triggerAll("before:element:refresh",view,model.atts);view.renderTemplate();view.triggerAll("element:refresh",view,model.atts);if(isEditing){view.$el.addClass("is-editing")}if(isSelected){view.$el.addClass("is-selected")}}})},250),onChangeOrder:function(){this.triggerAll("element:change:order",this)},onChangeParent:function(){this.triggerAll("element:change:parent",this)},onChangeSetting:function(setting,refresh){if(refresh){this.triggerAll("before:element:jsRefresh",this,this.model.get("atts"));app.channel.trigger("element:setting:change",setting,this);this.triggerAll("element:jsRefresh",this,this.model.get("atts"))}},initialize:function(){this._isReady=false;this._isBeingDestroyed=false;this.options.childViewContainer=this.model.get("child_container")||null;this.addEventListeners()},addEventListeners:function(){this.listenTo(app.channel,"before:elements:restore",this.onBeforeDestroy)},getChildView:function(child){return Tailor.lookup(child.get("tag"),child.get("type"),"Views")},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return child.get("parent")===this.model.get("id")},attachElContent:function(html){var $el=jQuery(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("draggable",true);this.el.setAttribute("tailor-label",this.model.get("label"));this.el.classList.add("tailor-"+this.model.cid);this.el.title=_l10n.edit_element;return this},getTemplateId:function(){return"tmpl-tailor-"+this.model.get("id")},getTemplate:function(){var el=document.querySelector("#"+this.getTemplateId());var template;if(el){template=_.template(el.innerHTML);el.parentElement.removeChild(el)}else{el=document.querySelector("#tmpl-tailor-"+this.model.get("tag")+"-default");template=_.template(el.innerHTML)}return template},updateTemplate:function(html){var templateId=this.getTemplateId();var el=document.querySelector("#"+templateId);if(!el){el=document.createElement("script");el.setAttribute("type","text/html");el.id=templateId;document.body.appendChild(el)}el.innerHTML=html},renderTemplate:function(){this._ensureViewIsIntact();var $childViewContainer=this.getChildViewContainer(this);var $children=$childViewContainer.contents().detach();this.resetChildViewContainer();this._renderTemplate();$childViewContainer=this.getChildViewContainer(this);$childViewContainer.append($children);return this},onBeforeRender:function(){this.triggerAll("before:element:ready",this)},onDomRefresh:function(){this.$el.find("a").attr({draggable:false,target:"_blank"});this.$el.find("img").attr({draggable:false})},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this)},onDestroy:function(){this.triggerAll("element:destroy",this)},beforeChildElementReady:function(childView){if(this._isReady&&this.children.contains(childView)){this.triggerAll("before:element:child:ready",childView)}},childElementReady:function(childView){if(this.children.contains(childView)){if(!this._isReady){var readyChildren=this.children.filter(function(childView){return childView._isReady}).length;if(this.children.length==readyChildren){this._isReady=true;this.triggerAll("element:ready",this)}}else{this.triggerAll("element:child:ready",childView)}}},beforeChildElementRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("before:element:child:refresh",childView)}},childElementRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:refresh",childView)}},beforeChildElementJSRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("before:element:child:jsRefresh",childView)}},childElementJSRefreshed:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:jsRefresh",childView)}},childElementChangeOrder:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:change:order",childView)}},childElementChangeParent:function(childView){if(this.children.contains(childView)){this.triggerAll("element:child:change:parent",childView)}},beforeChildElementDestroyed:function(childView){if(!this._isBeingDestroyed){this.triggerAll("before:element:child:destroy",childView)}},childElementDestroyed:function(childView){if(!this._isBeingDestroyed){this.triggerAll("element:child:destroy",childView)}},onDescendantAdded:function(e,view){this.triggerAll("element:descendant:add",view);e.stopPropagation()},onDescendantRemoved:function(e,view){this.triggerAll("element:descendant:remove",view);e.stopPropagation()},onBeforeDescendantReady:function(e,view){this.triggerAll("before:element:descendant:ready",view);e.stopPropagation()},onDescendantReady:function(e,view){this.triggerAll("element:descendant:ready",view);e.stopPropagation()},onBeforeDescendantRefreshed:function(e,view){this.triggerAll("before:element:descendant:refresh",view);e.stopPropagation()},onDescendantRefreshed:function(e,view){this.triggerAll("element:descendant:refresh",view);e.stopPropagation()},onBeforeDescendantJSRefreshed:function(e,view){this.triggerAll("before:element:descendant:jsRefresh",view);e.stopPropagation()},onDescendantJSRefreshed:function(e,view){this.triggerAll("element:descendant:jsRefresh",view);e.stopPropagation()},onDescendantChangeOrder:function(e,view){this.triggerAll("element:descendant:change:order",view);e.stopPropagation()},onDescendantChangeParent:function(e,view){this.triggerAll("element:descendant:change:parent",view);e.stopPropagation()},onBeforeDescendantDestroyed:function(e,view){this.triggerAll("before:element:descendant:destroy",view);e.stopPropagation()},onDescendantDestroyed:function(e,view){this.triggerAll("element:descendant:destroy",view);e.stopPropagation()},stopEventPropagation:function(e){e.stopPropagation()},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}},_updateIndices:function(view,increment,index){if(increment){view._index=index;view.model._changing=false;view.model.set("order",index)}this.children.each(function(laterView){if(laterView._index>=view._index){ +laterView._index+=increment?1:-1;laterView.model.set("order",laterView._index)}},this)}});module.exports=CompositeView},{}],18:[function(require,module,exports){var $=window.jQuery,ElementView;ElementView=Marionette.ItemView.extend({className:"element",attributes:{draggable:true},behaviors:{Draggable:{},Droppable:{},Editable:{},Movable:{}},modelEvents:{"change:atts":"onChangeAttributes","change:parent":"onChangeParent","change:setting":"onChangeSetting"},initialize:function(){this._isReady=false;this._isBeingDestroyed=false;this.addEventListeners()},addEventListeners:function(){this.listenTo(app.channel,"before:elements:restore",this.onBeforeDestroy)},getTemplateId:function(){return"tmpl-tailor-"+this.model.get("id")},getTemplate:function(){var el=document.querySelector("#"+this.getTemplateId());var template;if(el){template=_.template(el.innerHTML);el.parentElement.removeChild(el)}else{el=document.querySelector("#tmpl-tailor-"+this.model.get("tag")+"-default");template=_.template(el.innerHTML)}return template},attachElContent:function(html){var $el=$(html);var el=$el[0];this.$el.replaceWith(el);this.setElement(el);this.el.setAttribute("draggable",true);this.el.setAttribute("tailor-label",this.model.get("label"));this.el.classList.add("tailor-"+this.model.id);this.el.title=_l10n.edit_element;return this},updateTemplate:function(html){var templateId=this.getTemplateId();var el=document.querySelector("#"+templateId);if(!el){el=document.createElement("script");el.setAttribute("type","text/html");el.id=templateId;document.body.appendChild(el)}el.innerHTML=html},onChangeAttributes:_.debounce(function(model,atts){var view=this;model=model.toJSON();if(atts){model.atts=atts}view.el.classList.add("is-rendering");window.ajax.send("tailor_render",{data:{model:JSON.stringify(model),nonce:window._nonces.render},success:function(response){view.updateTemplate(response.html);app.channel.trigger("css:update",view.model.get("id"),response.css)},error:function(response){view.updateTemplate('

    The template for '+view.cid+" could not be refreshed

    ");console.log(response)},complete:function(){var isEditing=view.$el.hasClass("is-editing");var isSelected=view.$el.hasClass("is-selected");view.$el.removeClass("is-rendering");view.triggerAll("before:element:refresh",view,model.atts);view.render();view.triggerAll("element:refresh",view,model.atts);if(isEditing){view.$el.addClass("is-editing")}if(isSelected){view.$el.addClass("is-selected")}}})},500),onChangeSetting:function(setting,refresh){if(refresh){this.triggerAll("before:element:jsRefresh",this,this.model.get("atts"));app.channel.trigger("element:setting:change",setting,this);this.triggerAll("element:jsRefresh",this,this.model.get("atts"))}},onChangeParent:function(){this.triggerAll("element:change:parent",this)},onBeforeRender:function(){this.triggerAll("before:element:ready",this)},onDomRefresh:function(){var view=this;this.$el.find("a").attr({draggable:false,target:"_blank"});this.$el.find("[onchange]").removeAttr("onchange");this.$el.find("img").attr({draggable:false});this.$el.imagesLoaded(function(){view._isReady=true;if(view.el.classList.contains("tailor-widget")&&0==view.$el.children().innerHeight()){var el=document.querySelector("#tmpl-tailor-element-empty");if(el){view.$el.html(el.innerHTML)}}view.triggerAll("element:ready",view)})},onBeforeDestroy:function(){this.triggerAll("before:element:destroy",this)},onDestroy:function(){this.triggerAll("element:destroy",this)},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}}});module.exports=ElementView},{}],19:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Carousel;Carousel=Components.create({slickActive:false,getDefaults:function(){return{items:".tailor-carousel__item",prevArrow:'',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:true,fade:false}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.slick()},slick:function(){var component=this;component.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){this.$wrap.slick("refresh")},unSlick:function(){this.$wrap.slick("unslick")},onMove:function(){if(this.slickActive){this.refreshSlick()}},onBeforeCopy:function(){if(this.slickActive){this.unSlick()}},onCopy:function(){if(!this.slickActive){this.slick()}},onBeforeRefresh:function(){if(this.slickActive){this.unSlick()}},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){if(this.slickActive){this.unSlick()}},onResize:function(){if(this.slickActive){this.refreshSlick()}}});$.fn.tailorSimpleCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSimpleCarousel");if(!instance){$.data(this,"tailorSimpleCarousel",new Carousel(this,options,callbacks))}})}},{}],20:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Carousel;Carousel=Components.create({getDefaults:function(){return{items:".tailor-carousel__item",prevArrow:'',nextArrow:'',adaptiveHeight:false,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,initialSlide:0,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:false,infinite:false}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.slickAt(0,this.addEventListeners)},slickAt:function(index,callback){this.querySelectors();var numberItems=this.$items.length;if(!numberItems){return}index=Math.min(index,numberItems-1);if(index "+component.options.items);component.$dots=component.$el.children(".slick-dots").find(" > li");component.$dots.on("click",function(e){var $dot=$(e.currentTarget);component.currentSlide=$dot.data("id");component.$wrap.slick("slickGoTo",$dot.index());e.preventDefault()});if(!component.currentSlide){var $activeSlide=component.$items.filter(function(){return this.classList.contains("slick-current")});component.currentSlide=$activeSlide.length?$activeSlide.id:component.$items[0].id}},updateDots:function(index){this.$dots.each(function(i,el){if(index==i){el.classList.add("slick-active")}else{el.classList.remove("slick-active")}});this.$dots.toggle(this.$dots.length/this.options.slidesToShow>1)},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onBeforeRefresh:function(){this.unSlick()},onRefresh:function(){this.refreshSlick()},onJSRefresh:function(){this.refreshSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onAddChild:function(){this.refreshSlick()},onRemoveChild:function(e,childView){childView.$el.detach();this.refreshSlick()},onBeforeReadyChild:function(e,childView){this.unSlick()},onReadyChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeReorderChild:function(){this.unSlick()},onReorderChild:function(e,cid,index,oldIndex){this.querySelectors();this.slickAt(index)},onBeforeRefreshChild:function(){this.unSlick()},onRefreshChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeJSRefreshChild:function(){this.unSlick()},onJSRefreshChild:function(e,childView){this.slickAt(childView.$el.index())},onBeforeDestroyChild:function(){this.unSlick()},onDestroyChild:function(e,childView){var index=childView.$el.index();childView.$el.remove();this.slickAt(index)},onAddDescendant:function(){this.refreshSlick()},onRemoveDescendant:function(){this.refreshSlick()},onReadyDescendant:function(){this.refreshSlick()},onRefreshDescendant:function(){this.refreshSlick()},onJSRefreshDescendant:function(){this.refreshSlick()},onDestroyDescendant:function(){this.refreshSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorCarousel");if(!instance){$.data(this,"tailorCarousel",new Carousel(this,options,callbacks))}})}},{}],21:[function(require,module,exports){var ElementCollection=Backbone.Collection.extend({comparator:"order",model:function(attrs,options){var Model=Tailor.lookup(attrs.tag,attrs.type,"Models");return new Model(attrs,options)},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"change:parent",this.onChangeParent);this.listenTo(this,"add",this.onAdd);this.listenTo(this,"destroy",this.onDestroy);this.listenTo(this,"container:collapse",this.onCollapse);this.listenTo(this,"reset",this.onReset)},getElementDefinitions:function(){return this.library||app.channel.request("sidebar:library")},applyDefaults:function(model){if(model instanceof Backbone.Model){model=model.toJSON()}var item=this.getElementDefinitions().findWhere({tag:model.tag});var defaults={label:item.get("label"),type:item.get("type")};var child=item.get("child");if(child){defaults.child=child}var childViewContainer=item.get("child_container");if(childViewContainer){defaults.child_container=childViewContainer}model.atts=model.atts||{};_.each(item.get("settings"),function(setting){if(!_.isEmpty(setting["value"])&&!model.atts.hasOwnProperty(setting["id"])){model.atts[setting["id"]]=setting["value"]}});return _.extend(model,defaults)},getParent:function(model){return this.findWhere({id:model.get("parent")})},getChildren:function(model){return this.where({parent:model.get("id")})},getSiblings:function(model){return this.where({parent:model.get("parent")})},hasSelectedParent:function(model){var selected=app.channel.request("canvas:element:selected");if(!selected||model===selected){return false}var parentId=model.get("parent");var parent=this.findWhere({id:parentId});while("undefined"!==typeof parent){if(selected===parent){return true}parentId=parent.get("parent");parent=this.get(parentId)}return false},onChangeParent:function(model){var parent=this.get(model.get("parent"));var previousParent=this.get(model.previous("parent"));this.sort({silent:true});this._checkParent(previousParent);if("tailor_column"===model.get("tag")){this._reBalanceColumns(parent);this._reBalanceColumns(previousParent)}},onAdd:function(model,collection,options){if("tailor_column"==model.get("tag")){this._reBalanceColumns(this.get(model.get("parent")))}},onDestroy:function(model){var parent=this.get(model.get("parent"));this._checkParent(parent);var children=this.where({parent:model.get("id")});if(children.length){_.each(children,function(child){child.trigger("destroy",child,this)},this)}if(parent&&"tailor_column"===model.get("tag")){this._reBalanceColumns(parent)}if(0===this.length){this.onEmpty()}},onReset:function(){if(0===this.length){this.onEmpty()}},onEmpty:function(){var section=this.createSection(0);this.create([{tag:"tailor_content",atts:{},parent:section.get("id"),order:0}])},onCollapse:function(model,children){var parentId=model.get("parent");_.each(children,function(child){child.set("parent",parentId)},this)},add:function(models,options){if(_.isArray(models)){_.each(models,this.applyDefaults.bind(this))}else{this.applyDefaults(models)}return this.set(models,_.extend({merge:false},options,{add:true,remove:false}))},create:function(models,options){options=options||{};return this.add(models,options)},createSection:function(order){return _.first(this.create([{tag:"tailor_section",order:order}],{at:order}))},createRow:function(parentId,order){var row=_.first(this.create([{tag:"tailor_row",parent:parentId,order:order}],{}));return this.create([{tag:"tailor_column",atts:{width:"50%"},parent:row.get("id"),order:0},{tag:"tailor_column",atts:{width:"50%"},parent:row.get("id"),order:1}])},createColumn:function(parentId,order){return _.first(this.create([{tag:"tailor_column",parent:parentId,order:order}]))},createContainer:function(model,parentId,order,descendants){var tag=model.get("tag");var container=_.first(this.create([{tag:tag,parent:parentId,order:order}],{at:order,silent:true}));var childTag=model.get("child");var children=this.create([{tag:childTag,parent:container.get("id"),order:0},{tag:childTag,parent:container.get("id"),order:1}],{silent:true});if(descendants){_.first(descendants).set("parent",_.first(children).get("id"),{silent:true});_.last(descendants).set("parent",_.last(children).get("id"),{silent:true})}this.trigger("add",container,this,{})},createWrapper:function(tag,parentId,order,child){var wrapper=_.first(this.create([{tag:tag,parent:parentId,order:order}],{silent:true}));if("undefined"==typeof child){this.create([{tag:"tailor_content",parent:wrapper.get("id"),order:0}],{silent:true})}this.trigger("add",wrapper,this,{});if("undefined"!=typeof child){this.insertChild(child,wrapper)}return wrapper},createChild:function(model){var child=_.first(this.create([{tag:model.get("child"),parent:model.get("id"),order:this.getChildren(model).length}],{silent:true}));this.create([{tag:"tailor_content",parent:child.get("id"),order:0}],{silent:true});this.trigger("add",child,this,{});return child},insertChild:function(child,parent){if(!child){return}if(child.get("parent")!==parent.get("id")){child.trigger("remove:child")}parent.trigger("insert",child);child.trigger("add:child");child.set("parent",parent.get("id"))},_reBalanceColumns:function(model){var children=this.where({parent:model.get("id")});var numberChildren=children.length;_.each(children,function(child){var atts=_.clone(child.get("atts"));atts["width"]=Math.round(parseFloat(1/numberChildren)*1e3)/10+"%";delete atts["width_tablet"];delete atts["width_mobile"];child.set("atts",atts,{silent:true});child.trigger("change:width",child,atts)},this)},_checkParent:function(model){if(!model){return}if("container"==model.get("type")){this._checkCollapsibleContainer(model)}this._checkChildren(model)},_checkChildren:function(model){var children=this.where({parent:model.get("id")});if(0===children.length){model.trigger("destroy",model)}},_checkCollapsibleContainer:function(model){var childTag=this.getElementDefinitions().findWhere({tag:model.get("tag")}).get("child");var containerId=model.get("id");var children=this.filter(function(element){return containerId===element.get("parent")&&childTag===element.get("tag")});if(0===children.length){model.trigger("container:collapse",model,this.where({parent:containerId}))}else if(1===children.length){var child=_.first(children);if("tailor_row"===model.get("tag")){child.trigger("container:collapse",child,this.where({parent:child.get("id")}))}}}});module.exports=ElementCollection},{}],22:[function(require,module,exports){var ChildModel=require("./../element-child"),ColumnModel;ColumnModel=ChildModel.extend({validTarget:function(that,region){if(_.contains(["tailor_section","tailor_row"],that.get("tag"))||!_.contains(["left","right"],region)){return false}if("child"==that.get("type")&&that.get("tag")!=this.get("tag")){return false}var siblings=this.collection.getSiblings(this);return that.get("parent")==this.get("parent")||siblings.length<6}});module.exports=ColumnModel},{"./../element-child":28}],23:[function(require,module,exports){var ChildModel=require("./../element-child"),GridItemModel;GridItemModel=ChildModel.extend({validTarget:function(that,region){if("tailor_section"==that.get("tag")||_.contains(["top","bottom","center"],region)){return false}var parent=this.collection.getParent(this);if(parent.get("tag")==that.get("tag")){return false}return that.get("tag")==this.get("tag")}});module.exports=GridItemModel},{"./../element-child":28}],24:[function(require,module,exports){var ContainerModel=require("./../element-container"),CarouselModel;CarouselModel=ContainerModel.extend({createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();var $navigation=view.$el.find(".slick-dots").detach();this.appendTemplate(id,view);$childViewContainer.append($children);$navigation.insertAfter($childViewContainer);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=CarouselModel},{"./../element-container":30}],25:[function(require,module,exports){var ContainerModel=require("./../element-container"),RowModel;RowModel=ContainerModel.extend({validTarget:function(that,region){if("child"==that.get("type")||"tailor_section"==that.get("tag")||"center"==region){return false}return _.contains(["top","bottom"],region)&&"tailor_column"!=that.get("tag")}});module.exports=RowModel},{"./../element-container":30}],26:[function(require,module,exports){var ContainerModel=require("./../element-container"),TabsModel;TabsModel=ContainerModel.extend({createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();var $navigation=view.$el.find(".tailor-tabs__navigation");var $navigationItems=$navigation.children().detach();this.appendTemplate(id,view);$childViewContainer.append($children);$navigation.append($navigationItems);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=TabsModel},{"./../element-container":30}],27:[function(require,module,exports){var Model;Backbone.Model.prototype.set=_.wrap(Backbone.Model.prototype.set,function(oldSet,key,val,options){if(key==null)return this;var attrs;if(typeof key==="object"){attrs=key;options=val}else{(attrs={})[key]=val}options||(options={});var ret=oldSet.call(this,attrs,options);if(this._tracking){_.each(attrs,_.bind(function(val,key){if(_.isEqual(this._original[key],val)){delete this._unsaved[key]}else{this._unsaved[key]=val}},this))}return ret});Model=Backbone.Model.extend({_tracking:false,_original:{},_unsaved:{},defaults:function(){return{id:this.cid,tag:"",label:"",atts:{},parent:"",order:0,collection:"element"}},isTracking:function(){return this._tracking},startTracking:function(){this._tracking=true;this.resetTracking();return this},stopTracking:function(){this._tracking=false;this._original={};this._unsaved={};return this},resetTracking:function(){this._original=_.clone(this.attributes);this._unsaved={};return this},resetAttributes:function(){if(!this._tracking){return}this.attributes=this._original;this.resetTracking();this.trigger("change:atts",this,this.get("atts"));return this},toShortcode:function(){var tag=this.get("tag");var atts=this.get("atts");var content="";var shortcode="["+tag;_.each(atts,function(attr,id){if(attr){if("content"===id){content=attr}else{if(_.isNumber(id)){if(/\s/.test(attr)){shortcode+=' "'+attr+'"'}else{shortcode+=" "+attr}}else{shortcode+=" "+id+'="'+attr+'"'}}}},this);return shortcode+"]"+content+"[/"+tag+"]"},insertBefore:function(view){this.trigger("remove:child");this.trigger("insert:before",view);this.trigger("add:child");this.set("parent",view.model.get("parent"))},insertAfter:function(view){this.trigger("remove:child");this.trigger("insert:after",view);this.trigger("add:child");this.set("parent",view.model.get("parent"))},columnBefore:function(view){var model=view.model;var parent=model.get("parent");if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(parent,model.get("order")-1);this.collection.insertChild(this,column)}else{var columns=this.collection.createRow(parent,model.get("order"));this.collection.insertChild(this,_.first(columns));this.collection.insertChild(model,_.last(columns))}},columnAfter:function(view){var model=view.model;var parent=model.get("parent");if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(parent,model.get("order"));this.collection.insertChild(this,column)}else{var columns=this.collection.createRow(parent,model.get("order"));this.collection.insertChild(model,_.first(columns));this.collection.insertChild(this,_.last(columns))}},beforeCopyElement:function(view){var el=view.el;view.triggerAll("before:element:copy",view);el.classList.remove("is-dragging");el.classList.remove("is-hovering");el.classList.remove("is-selected");el.classList.remove("is-editing")},appendTemplate:function(id,view){var oldId=view.model.get("id");var template=document.createElement("script");template.setAttribute("type","text/html");template.id="tmpl-tailor-"+id;template.innerHTML=view.el.outerHTML.replace(oldId,id);document.body.appendChild(template)},afterCopyElement:function(id,view){var oldId=view.model.get("id");view.$el.trigger("element:copy",view);app.channel.trigger("css:copy",oldId,id)}});module.exports=Model},{}],28:[function(require,module,exports){var CompositeModel=require("./element-composite"),ChildModel;ChildModel=CompositeModel.extend({validTarget:function(that,region){if("tailor_section"==that.get("tag")||_.contains(["left","right","center"],region)){return false}var parent=this.collection.getParent(this);if(parent.get("tag")==that.get("tag")){return false}return that.get("tag")==this.get("tag")},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.insertBefore);this.listenTo(this,"element:move:right",this.insertAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyBefore);this.listenTo(this,"element:copy:right",this.copyAfter)}});module.exports=ChildModel},{"./element-composite":29}],29:[function(require,module,exports){var BaseModel=require("./element-base"),CompositeModel;CompositeModel=BaseModel.extend({cloneContainer:function(sourceView,parent,index){var collection=this.collection;var clone=sourceView.model.clone();clone.set("id",clone.cid);clone.set("parent",parent);clone.set("order",index);this.createTemplate(clone.cid,sourceView);var clonedChildren=this.cloneChildren(sourceView.children,clone,[]);collection.add(clonedChildren,{silent:true});collection.add(clone);sourceView.triggerMethod("element:refresh")},cloneChildren:function(childViews,parent,clones){if(childViews.length){childViews.each(function(childView){var clone=childView.model.clone();clone.set("id",clone.cid);clone.set("parent",parent.get("id"));clone.createTemplate(clone.cid,childView);clones.push(clone);if(childView.children){this.cloneChildren(childView.children,clone,clones)}},this)}return clones},copyBefore:function(targetView,sourceView){this.cloneContainer(sourceView,targetView.model.get("parent"),targetView.model.get("order")-1)},copyAfter:function(targetView,sourceView){this.cloneContainer(sourceView,targetView.model.get("parent"),targetView.model.get("order"))},copyColumnBefore:function(targetView,sourceView){var parent=targetView.model.get("parent");if("tailor_column"===targetView.model.get("tag")){var column=this.collection.createColumn(parent,targetView.model.get("order")-1);this.cloneContainer(sourceView,column.get("id"),0)}else{var columns=this.collection.createRow(parent,targetView.model.get("order"));this.collection.insertChild(targetView.model,_.last(columns));this.cloneContainer(sourceView,_.first(columns).get("id"),0)}},copyColumnAfter:function(targetView,sourceView){var parent=targetView.model.get("parent");if("tailor_column"===targetView.model.get("tag")){var column=this.collection.createColumn(parent,targetView.model.get("order"));this.cloneContainer(sourceView,column.get("id"),0)}else{var columns=this.collection.createRow(parent,targetView.model.get("order"));this.collection.insertChild(targetView.model,_.first(columns));this.cloneContainer(sourceView,_.last(columns).get("id"),0)}},createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);var $childViewContainer=view.getChildViewContainer(view);var $children=$childViewContainer.contents().detach();this.appendTemplate(id,view);$childViewContainer.append($children);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=CompositeModel},{"./element-base":27}],30:[function(require,module,exports){var CompositeModel=require("./element-composite"),ContainerModel;ContainerModel=CompositeModel.extend({validTarget:function(that,region){if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("center"==region){return"container"!=that.get("type")}if(_.contains(["wrapper","child"],parent.get("type"))){if(_.contains(["top","bottom"],region)){return _.contains(["tailor_section","tailor_column"],parent.get("tag"))||!_.contains(["container","wrapper","child"],that.get("type"))}return"tailor_section"==parent.get("tag")||!_.contains(["left","right"],region)}return"container"!=that.get("type")},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter)}});module.exports=ContainerModel},{"./element-composite":29}],31:[function(require,module,exports){var CompositeModel=require("./element-composite"),WrapperModel;WrapperModel=CompositeModel.extend({validTarget:function(that,region){if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))||"center"==region){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("child"==parent.get("type")&&"tailor_column"!=parent.get("tag")){return"container"!=that.get("type")&&!_.contains(["left","right"],region)}if(_.contains(["container","wrapper","child"],parent.get("type"))){return"tailor_section"==parent.get("tag")||!_.contains(["left","right"],region)}return true},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter);this.listenTo(this,"element:move:center",this.createChild);this.listenTo(this,"element:copy:center",this.copyChild)},createChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;this.createTemplate(sourceView.model.get("id"),sourceView);this.collection.createWrapper(childTag,id,numberChildren,sourceView.model)},copyChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;var wrapper=this.collection.createWrapper(childTag,id,numberChildren,false);this.cloneContainer(sourceView,wrapper.get("id"),0)}});module.exports=WrapperModel},{"./element-composite":29}],32:[function(require,module,exports){var BaseModel=require("./element-base"),ElementModel;ElementModel=BaseModel.extend({validTarget:function(that,region,threshold){if(threshold<20){return false}if("child"==that.get("type")||_.contains(["tailor_section","tailor_column"],that.get("tag"))||"center"==region){return false}var parent=this.collection.getParent(this);if("tailor_row"==that.get("tag")){return"tailor_section"==parent.get("tag")&&_.contains(["top","bottom"],region)}if("child"==parent.get("type")&&"tailor_column"!=parent.get("tag")){return"container"!=that.get("type")&&!_.contains(["left","right"],region)}if(_.contains(["wrapper","child"],parent.get("type"))){if(_.contains(["top","bottom"],region)){return _.contains(["tailor_section","tailor_column"],parent.get("tag"))||!_.contains(["container","wrapper","child"],that.get("type"))}return"tailor_section"==parent.get("tag")||_.contains(["left","right"],region)}return true},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:move:top",this.insertBefore);this.listenTo(this,"element:move:bottom",this.insertAfter);this.listenTo(this,"element:move:left",this.columnBefore);this.listenTo(this,"element:move:right",this.columnAfter);this.listenTo(this,"element:copy:top",this.copyBefore);this.listenTo(this,"element:copy:bottom",this.copyAfter);this.listenTo(this,"element:copy:left",this.copyColumnBefore);this.listenTo(this,"element:copy:right",this.copyColumnAfter);this.listenTo(this,"element:move:center",this.createChild);this.listenTo(this,"element:copy:center",this.copyChild)},copyBefore:function(targetView,sourceView){var clone=sourceView.model.clone();var index=targetView.model.get("order")-1;clone.set("id",clone.cid);clone.set("parent",targetView.model.get("parent"));clone.set("order",index);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},copyAfter:function(targetView,sourceView){var clone=sourceView.model.clone();var index=targetView.model.get("order");clone.set("id",clone.cid);clone.set("parent",targetView.model.get("parent"));clone.set("order",index);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},copyColumnBefore:function(targetView,sourceView){var model=targetView.model;var clone=sourceView.model.clone();clone.set("id",clone.cid);this.createTemplate(clone.cid,sourceView);if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(model.get("parent"),model.get("order")-1);clone.set("parent",column.get("id"));this.collection.add(clone)}else{var columns=this.collection.createRow(model.get("parent"),model.get("order"));this.collection.insertChild(model,_.last(columns));clone.set("parent",_.first(columns).get("id"));this.collection.add(clone)}},copyColumnAfter:function(targetView,sourceView){ +var model=targetView.model;var clone=sourceView.model.clone();clone.set("id",clone.cid);this.createTemplate(clone.cid,sourceView);if("tailor_column"===model.get("tag")){var column=this.collection.createColumn(model.get("parent"),model.get("order"));clone.set("parent",column.get("id"));this.collection.add(clone)}else{var columns=this.collection.createRow(model.get("parent"),model.get("order"));this.collection.insertChild(model,_.first(columns));clone.set("parent",_.last(columns).get("id"));this.collection.add(clone)}},createChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;this.appendTemplate(sourceView.model.get("id"),sourceView);this.collection.createWrapper(childTag,id,numberChildren,sourceView.model)},copyChild:function(targetView,sourceView){var id=targetView.model.get("id");var childTag=targetView.model.get("child");var numberChildren=this.collection.where({parent:id,tag:childTag}).length;var wrapper=this.collection.createWrapper(childTag,id,numberChildren,false);var clone=sourceView.model.clone();clone.set("id",clone.cid);clone.set("parent",wrapper.get("id"));clone.set("order",0);this.createTemplate(clone.cid,sourceView);this.collection.add(clone)},createTemplate:function(id,view){var isEditing=view.el.classList.contains("is-editing");this.beforeCopyElement(view);this.appendTemplate(id,view);this.afterCopyElement(id,view);if(isEditing){view.el.classList.add("is-editing")}}});module.exports=ElementModel},{"./element-base":27}],33:[function(require,module,exports){var WrapperModel=require("./../element-wrapper"),SectionModel;SectionModel=WrapperModel.extend({validTarget:function(that,region){return"tailor_section"==that.get("tag")&&!_.contains(["left","right","center"],region)}});module.exports=SectionModel},{"./../element-wrapper":31}],34:[function(require,module,exports){var CanvasRegion=Backbone.Marionette.Region.extend({initialize:function(){this.listenTo(app.channel,"canvas:dragstart",this.onDragStart);this.listenTo(app.channel,"canvas:dragend",this.onDragEnd)},onDragStart:function(view,region,options){this.el.classList.add("is-active")},onDragEnd:function(view,region,options){this.el.classList.remove("is-active")}});module.exports=CanvasRegion},{}],35:[function(require,module,exports){var $=Backbone.$,$win=$(window),$doc=$(document),CanvasCollectionView=require("./show/canvas-view"),CanvasModule;CanvasModule=Marionette.Module.extend({onStart:function(){this._model=null;this._isDragging=false;this.collection=app.channel.request("canvas:elements");this.addEventListeners();this.showCanvas();app.channel.trigger("module:canvas:ready",this)},addEventListeners:function(){this.listenTo(app.channel,"canvas:dragstart",this.onDragStart);this.listenTo(app.channel,"canvas:dragover",this.onDragOver);this.listenTo(app.channel,"canvas:dragend",this.onDragEnd);this.listenTo(app.channel,"canvas:drop",this.onDrop);$doc.on("click dragover",this.reset.bind(this));$win.on("resize",this.reset.bind(this))},showCanvas:function(){app.canvasRegion.show(new CanvasCollectionView({collection:this.collection}))},onDragStart:function(e,view){var collection=view.model.collection;if("function"===typeof collection.hasSelectedParent&&collection.hasSelectedParent(view.model)){return}this._view=view;this._model=view.model;this._isDragging=true;view.el.classList.add("is-dragging");if("element"==view.model.get("collection")){var testVar=window.DataTransfer||window.Clipboard;if("setDragImage"in testVar.prototype){var dragImage=document.createElement("img");dragImage.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";e.dataTransfer.setDragImage(dragImage,0,0)}}e.dataTransfer.effectAllowed="copyMove";e.dataTransfer.setData("Text",this._model.cid);e.stopPropagation()},onDragOver:function(e,view){if(!this._isDragging){return}if(e.pageY){var scrollY=window.scrollY||document.documentElement.scrollTop;if(e.pageY-scrollY<40){window.scrollTo(0,scrollY-20)}else if(scrollY+window.innerHeight-e.pageY<40){window.scrollTo(0,scrollY+20)}}var action="element"===this._model.get("collection")&&e.shiftKey?"copy":"move";if("move"===action&&view.model===this._model){this.reset();e.stopPropagation();return}var region=this._getDropRegion(e,view);if(!view.model.validTarget(this._model,region)){return}e.dataTransfer.dropEffect=action;app.channel.trigger("canvas:guide",view,region);e.preventDefault();e.stopPropagation()},onDrop:function(e,view){if(!this._isDragging){return}var model=this._model;var region=this._getDropRegion(e,view);if(!view.model.validTarget(model,region)){return}var action;if("element"===model.get("collection")){action=e.shiftKey?"copy":"move";if("move"===action&&view.model===model){return}}else{action="add"}model.trigger("element:"+action+":"+region,view,this._view);app.channel.trigger("element:"+action,model);this.collection.sort({silent:true});e.preventDefault();e.stopPropagation()},onDragEnd:function(e,view){if(!this._isDragging){return}this._isDragging=false;this._view.el.classList.remove("is-dragging");this.reset()},reset:function(){app.channel.trigger("canvas:reset")},_getPoint:function(e){if(e.targetTouches){return{x:e.targetTouches[0].clientX,y:e.targetTouches[0].clientY}}return{x:e.clientX,y:e.clientY}},_getDropRegion:function(e,view){var point=this._getPoint(e);var rect=view.el.getBoundingClientRect();var width=rect.width/2;var height=rect.height/2;var top=rect.top+(rect.height-height)/2;var left=rect.left+(rect.width-width)/2;if(left<=point.x&&point.x<=left+width&&top<=point.y&&point.y<=top+height){return"center"}else{var x=(point.x-(rect.left+width))/width;var y=(point.y-(rect.top+height))/height;if(Math.abs(x)>Math.abs(y)){return x>0?"right":"left"}return y>0?"bottom":"top"}}});module.exports=CanvasModule},{"./show/canvas-view":36}],36:[function(require,module,exports){module.exports=Marionette.CollectionView.extend({behaviors:{Container:{}},getChildView:function(){return Tailor.lookup("tailor_section","wrapper","Views")},buildChildView:function(child,ChildViewClass,childViewOptions){var options=_.extend({model:child,collection:this.collection},childViewOptions);return new ChildViewClass(options)},filter:function(child,index,collection){return!child.get("parent")},_updateIndices:function(view,increment,index){if(increment){view._index=index;view.model._changing=false;view.model.set("order",index)}this.children.each(function(laterView){if(laterView._index>=view._index){laterView._index+=increment?1:-1;laterView.model.set("order",laterView._index)}},this)},triggerAll:function(event,view,atts){this.$el.trigger(event,view);this.triggerMethod(event,view);if(atts){app.channel.trigger(event,this,atts)}else{app.channel.trigger(event,this)}}})},{}],37:[function(require,module,exports){var Stylesheet=require("./stylesheet"),CSSModule;CSSModule=Marionette.Module.extend({onStart:function(options){this.stylesheets=[];this.collection=app.channel.request("canvas:elements");this.createSheets(options.mediaQueries||{});this.addRules(options.cssRules||{});this.addEventListeners();app.channel.trigger("module:css:ready",this)},addEventListeners:function(){this.listenTo(app.channel,"css:add",this.addRules);this.listenTo(app.channel,"css:delete",this.deleteRules);this.listenTo(app.channel,"css:update",this.updateRules);this.listenTo(app.channel,"css:copy",this.copyRules);this.listenTo(app.channel,"css:clear",this.clearRules);this.listenTo(this.collection,"destroy",this.onDestroy)},createSheet:function(id,min,max){var media="only screen";if(min){media+=" and (min-width: "+min+")"}if(max){media+=" and (max-width: "+max+")"}return new Stylesheet(id,media)},createSheets:function(mediaQueries){_.each(mediaQueries,function(atts,id){if(!_.isEmpty(atts.min)){if(!_.isEmpty(atts.max)){this.stylesheets[id+"-up"]=this.createSheet(id+"-up",atts.min);this.stylesheets[id]=this.createSheet(id,atts.min,atts.max)}else{this.stylesheets[id]=this.createSheet(id,atts.min)}}else{if(!_.isEmpty(atts.max)){this.stylesheets[id]=this.createSheet(id,null,atts.max)}else{this.stylesheets[id]=this.createSheet(id)}}},this);app.channel.trigger("module:css:stylesheets:ready",this)},getSheet:function(id){if(this.stylesheets.hasOwnProperty(id)){return this.stylesheets[id]}return false},addRules:function(cssRules){for(var queryId in cssRules){if(cssRules.hasOwnProperty(queryId)){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].addRules(cssRules[queryId])}}}},clearRules:function(){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].clearRules()}}},copyRules:function(elementId,newElementId){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){var rules=this.stylesheets[queryId].getRules(elementId);if(rules.length){for(var rule in rules){if(rules.hasOwnProperty(rule)){rules[rule].selectors=rules[rule].selectors.replace(new RegExp(elementId,"g"),newElementId)}}var rulesSet={};rulesSet[queryId]={};rulesSet[queryId][newElementId]=rules;this.addRules(rulesSet)}}}},deleteRules:function(elementId,settingId){for(var queryId in this.stylesheets){if(this.stylesheets.hasOwnProperty(queryId)){this.stylesheets[queryId].deleteRules(elementId,settingId)}}},updateRules:function(elementId,cssRules){this.deleteRules(elementId);this.addRules(cssRules)},onReset:function(){this.clearRules()},onDestroy:function(model){this.deleteRules(model.get("id"))}});module.exports=CSSModule},{"./stylesheet":38}],38:[function(require,module,exports){function Stylesheet(id,media){this.id=id;this.initialize(media)}Stylesheet.prototype={initialize:function(media){this.stylesheet=this.createStylesheet(media);this.sheet=this.stylesheet.sheet;this.lookup=[]},createStylesheet:function(media){var style=document.createElement("style");style.appendChild(document.createTextNode(""));media=media||"screen";style.setAttribute("media",media);style.setAttribute("id","tailor-"+this.id);document.head.appendChild(style);return style},addRules:function(ruleSet){for(var elementId in ruleSet){if(ruleSet.hasOwnProperty(elementId)){this.lookup=this.lookup||[];for(var i in ruleSet[elementId]){if(ruleSet[elementId].hasOwnProperty(i)){this.addRule(elementId,ruleSet[elementId][i])}}}}},addRule:function(elementId,rule){if(this.checkRule(rule)){var selectors=Tailor.CSS.parseSelectors(rule["selectors"],elementId);var declarations=Tailor.CSS.parseDeclarations(rule["declarations"]);if(!_.isEmpty(declarations)){var settingId=rule["setting"];Tailor.CSS.addRule(this.sheet,selectors,declarations,this.lookup.length);this.lookup.push({elementId:elementId,settingId:settingId})}}},checkRule:function(rule){return _.has(rule,"selectors")&&_.has(rule,"declarations")&&_.has(rule,"setting")},getRules:function(elementId){var rules=[];for(var i=0;i-1){rules.push({selectors:rule.selectorText,declarations:rule.style.cssText,setting:this.lookup[i]["settingId"]||""})}}}return rules},deleteRules:function(elementId,settingId){for(var i=0;i1){module.collection.add(parents,{at:index+1})}else{parents[0].parent=parent;parents[0].order=index;module.collection.add(parents)}app.channel.trigger("template:add",model)}canvas.classList.remove("is-loading")}})}};app.channel.on("template:load",api.loadTemplate);app.channel.trigger("module:templates:ready",this)}});module.exports=TemplateModule},{}],41:[function(require,module,exports){var SelectRegion=Backbone.Marionette.Region.extend({onShow:function(view,region,options){view._view.el.classList.add("is-selected")},onEmpty:function(view,region,options){view._view.el.classList.remove("is-selected")}});module.exports=SelectRegion},{}],42:[function(require,module,exports){var GuideView=Marionette.ItemView.extend({template:false,position:function(view,drop){var $el=view.$el;var offset=$el.offset();var parentOffset=this.$el.offsetParent().offset();this.el.style.visibility="visible";this.el.className="guide guide--"+drop+" guide--"+view.model.get("tag");this.el.style.left=offset.left-parentOffset.left+"px";this.el.style.top=offset.top-parentOffset.top+"px";this.el.style.width=$el.outerWidth()+"px";this.el.style.height=$el.outerHeight()+"px";this.el.style.opacity=1},reset:function(){this.el.style="";this.el.style.visibility="hidden";this.el.style.opacity=0}});module.exports=GuideView},{}],43:[function(require,module,exports){var SelectMenuItemView=Marionette.ItemView.extend({tagName:"div",className:"select__item",events:{click:"onClick"},getTemplate:function(){return _.template("<%= label %>")},onClick:function(e){if(0===this._index){this.triggerMethod("toggle")}else{this.model.trigger("select")}e.stopPropagation()}});module.exports=SelectMenuItemView},{}],44:[function(require,module,exports){var SelectMenuItemView=require("./select-menu-item"),SelectMenuView;SelectMenuView=Marionette.CompositeView.extend({className:"select",childView:SelectMenuItemView,childViewContainer:".select__menu",ui:{add:".js-add",edit:".js-edit",copy:".js-copy",delete:".js-delete"},events:{"click @ui.add":"addElement","click @ui.edit":"editElement","click @ui.copy":"copyElement","click @ui.delete":"deleteElement"},modelEvents:{destroy:"destroy"},childEvents:{toggle:"toggleMenu"},template:"#tmpl-tailor-tools-select",serializeData:function(){var data=Backbone.Marionette.CompositeView.prototype.serializeData.apply(this,arguments);data.type=this.model.get("type");data.siblings=this.collection.where({parent:this.model.get("parent")}).length;return data},initialize:function(options){this._view=options.view},_filteredSortedModels:function(){var models=[];var model=this.model;while("undefined"!==typeof model){models.push(model);model=this.collection.get(model.get("parent"))}return models},onDomRefresh:function(){var thisRect=this.el.parentNode.getBoundingClientRect();var thatRect=this._view.el.getBoundingClientRect();var style=getComputedStyle(this._view.el,null);var borderTop=parseInt(style.getPropertyValue("border-top-width"),10);var borderRight=parseInt(style.getPropertyValue("border-right-width"),10);var borderBottom=parseInt(style.getPropertyValue("border-bottom-width"),10);var borderLeft=parseInt(style.getPropertyValue("border-left-width"),10);var left=Math.round(parseFloat(thatRect.left))+borderLeft;var right=Math.min(window.innerWidth+1,Math.round(thatRect.right)-borderRight);var width=right-left;this.el.style.top=Math.round(parseFloat(thatRect.top-parseFloat(thisRect.top)))+borderTop+"px";this.el.style.left=left-thisRect.left+"px";this.el.style.width=width+"px";this.el.style.height=Math.round(parseFloat(thatRect.height))-borderTop-borderBottom+"px";var controls=this.el.querySelector(".select__controls");var menu=this.el.querySelector(".select__menu");if(menu&&controls){var menuRect=menu.getBoundingClientRect();var controlsRect=controls.getBoundingClientRect();if(menuRect.width+controlsRect.width>parseInt(this.el.style.width,10)){this.el.classList.add("is-minimal")}}},addElement:function(){var child=this.model.collection.createChild(this.model);child.set("collection","library",{silent:true});app.channel.trigger("element:add",child)},editElement:function(){app.channel.trigger("modal:open",this.model)},copyElement:function(){this.model.copyAfter(this._view,this._view);app.channel.trigger("element:copy",this.model)},deleteElement:function(){this.model.trigger("destroy",this.model);app.channel.trigger("element:delete",this.model)},toggleMenu:function(){this.$el.toggleClass("is-expanded")}});module.exports=SelectMenuView},{"./select-menu-item":43}],45:[function(require,module,exports){var GuideView=require("./show/guide"),SelectorView=require("./show/select-menu"),ToolsModule;ToolsModule=Marionette.Module.extend({onStart:function(){var guide=new GuideView({el:"#guide"}).render();var api={positionGuide:function(view,drop){guide.position(view,drop)},selectElement:function(view){app.selectRegion.show(new SelectorView({model:view.model,collection:app.channel.request("canvas:elements"),view:view}))},resetGuide:function(){guide.reset();app.selectRegion.empty()},getSelectedElement:function(){var select=app.selectRegion.currentView;return select?select.model:null}};this.listenTo(app.channel,"canvas:guide",api.positionGuide);this.listenTo(app.channel,"canvas:select",api.selectElement);this.listenTo(app.channel,"canvas:reset",api.resetGuide);this.listenTo(app.channel,"element:refresh:template",api.resetGuide);app.channel.reply("canvas:element:selected",api.getSelectedElement);app.channel.trigger("module:tools:ready",this)}});module.exports=ToolsModule},{"./show/guide":42,"./show/select-menu":44}],46:[function(require,module,exports){require("./preview/helpers");require("./preview/behaviors");require("./preview/css")},{"./preview/behaviors":47,"./preview/css":48,"./preview/helpers":49}],47:[function(require,module,exports){(function($,app,SettingAPI,ElementAPI){ElementAPI.onRender("tailor_carousel",function(atts,model){var carousel=this;var options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:false,fade:"1"==atts.fade&&"1"==atts.items_per_row,slidesToShow:parseInt(atts.items_per_row,10)||1,adaptiveHeight:true};carousel.$el.tailorCarousel(options)});ElementAPI.onRender("tailor_content",function(atts,model){if(this.$el.find(".is-lightbox-image").length>0){this.$el.tailorLightbox({disableOn:function(){return $el.hasClass("is-selected")}})}});ElementAPI.onRender("tailor_gallery",function(atts,model){var $el=this.$el;var options;if("carousel"==atts.layout){options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:"1"==atts.dots,fade:"1"==atts.fade&&"1"==atts.items_per_row,infinite:false,slidesToShow:parseInt(atts.items_per_row,10)||2};$el.tailorSimpleCarousel(options)}else if("slideshow"==atts.layout){options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:false,fade:true,items:".tailor-slideshow__slide",adaptiveHeight:true,draggable:false,speed:250};if("1"==atts.thumbnails){options.customPaging=function(slider,i){var thumb=$(slider.$slides[i]).data("thumb");return''};options.dots=true}$el.tailorSlideshow(options)}else if(atts.masonry){$el.tailorMasonry()}if(this.el.classList.contains("is-lightbox-gallery")){$el.tailorLightbox({disableOn:function(){return $el.hasClass("is-selected")}})}});ElementAPI.onRender("tailor_map",function(atts,model){this.$el.tailorGoogleMap()});ElementAPI.onRender("tailor_posts",function(atts,model){var $el=this.$el;var options;if("carousel"==atts.layout){options={autoplay:"1"==atts.autoplay,autoplaySpeed:atts.autoplay_speed,arrows:"1"==atts.arrows,dots:"1"==atts.dots,fade:"1"==atts.fade&&"1"==atts.items_per_row,infinite:false,slidesToShow:parseInt(atts.items_per_row,10)||2};this.$el.tailorSimpleCarousel(options)}else if(atts.masonry){$el.tailorMasonry()}});ElementAPI.onRender("tailor_section",function(atts,model){if(atts["background_image"]&&atts["parallax"]&&1==atts["parallax"]){this.$el.tailorParallax()}});ElementAPI.onRender("tailor_tabs",function(atts,model){this.$el.tailorTabs()});ElementAPI.onRender("tailor_toggles",function(atts,model){this.$el.tailorToggles()})})(window.jQuery,window.app,window.Tailor.Api.Setting,window.Tailor.Api.Element)},{}],48:[function(require,module,exports){var $=Backbone.$,$win=$(window);(function(window,app,SettingAPI){var cssRules=window._pageRules||[];var cssCollection={_tailor_section_width:"",_tailor_column_spacing:"",_tailor_element_spacing:"",_tailor_page_css:""};var stylesheet=document.createElement("style");stylesheet.appendChild(document.createTextNode(""));stylesheet.setAttribute("media","screen");stylesheet.setAttribute("id","tailor-settings");document.head.appendChild(stylesheet);function getStyleValues(string){var values;if(-1!=string.indexOf(",")){values=string.split(",")}else{values=string.split("-")}if(2==values.length){values=_.object(["top","bottom"],values)}else if(4==values.length){values=_.object(["top","right","bottom","left"],values)}else{values={}}return values}function getMediaQuery(string){var query="";_.each(["_tablet","_mobile"],function(target){if(string.substring(string.length-target.length)==target){query=target.substring(1)}});return query}function generateCSS(settingId,value){cssCollection[settingId]="";value=_.isString(value)?value.trim():value;if(!_.isEmpty(value)){_.each(cssRules[settingId],function(rule){var selectors=Tailor.CSS.parseSelectors(rule.selectors);var declarations=Tailor.CSS.parseDeclarations(rule.declarations).replace(/\{\{(.*?)\}\}/g,value);cssCollection[settingId]+="\n"+selectors+" {"+declarations+"}"})}}function updateStylesheet(){var value="";for(var settingId in cssCollection){if(cssCollection.hasOwnProperty(settingId)){value+=cssCollection[settingId]}}stylesheet.innerHTML=value;$win.trigger("resize")}app.channel.on("module:css:stylesheets:ready",function(cssModule){var settings=app.channel.request("sidebar:settings");if(settings&&settings.length){settings.each(function(setting){var id=setting.get("id");var value=setting.get("value");value=_.isString(value)?value.trim():value;if(!_.isEmpty(value)&&cssCollection.hasOwnProperty(id)){if(cssRules.hasOwnProperty(id)){generateCSS(id,value)}else{cssCollection[id]=value}}})}updateStylesheet();var ids=["_tailor_section_width","_tailor_column_spacing","_tailor_element_spacing"];_.each(ids,function(settingId){if(cssRules.hasOwnProperty(settingId)){SettingAPI.onChange("sidebar:"+settingId,function(to,from){generateCSS(settingId,to);updateStylesheet()})}});SettingAPI.onChange("sidebar:_tailor_page_css",function(to,from){cssCollection["_tailor_page_css"]=to;updateStylesheet()});SettingAPI.onChange("sidebar:_post_title",function(to,from){$("h1, h2, h1 a, h2 a").each(function(){if(from==this.textContent){this.textContent=to}})});window.Tailor.Settings.overrides={"*":{},tailor_button:{color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"color","tailorValidateColor"],background_color:[[".tailor-button__inner"],"background-color","tailorValidateColor"],background_color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"background-color","tailorValidateColor"],border_color:[[".tailor-button__inner"],"border-color","tailorValidateColor"],border_color_hover:[[".tailor-button__inner:hover",".tailor-button__inner:focus"],"border-color","tailorValidateColor"],padding:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],padding_tablet:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],padding_mobile:[[".tailor-button__inner"],"padding-{0}","tailorValidateUnit"],margin:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],margin_tablet:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],margin_mobile:[[".tailor-button__inner"],"margin-{0}","tailorValidateUnit"],border_width:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[[".tailor-button__inner"],"border-{0}-width","tailorValidateUnit"],border_radius:[[".tailor-button__inner"],"border-radius","tailorValidateUnit"],shadow:[[".tailor-button__inner"],"box-shadow"]},tailor_card:{border_color:[["",".tailor-card__header"],"border-color","tailorValidateColor"],padding:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"],padding_tablet:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"],padding_mobile:[[".tailor-card__content"],"padding-{0}","tailorValidateUnit"]},tailor_carousel:{border_color:[["",".slick-dots"],"border-color","tailorValidateColor"]},tailor_grid:{border_color:[[".tailor-grid__item"],"border-color","tailorValidateColor"],border_style:function(to,from,model){return[{selectors:["&.tailor-grid--bordered .tailor-grid__item"],declarations:{"border-style":tailorValidateString(to)+"!important"}}]},border_width:function(to,from,model){return[{selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]},border_width_tablet:function(to,from,model){return[{media:"tablet",selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]},border_width_mobile:function(to,from,model){return[{media:"mobile",selectors:[".tailor-grid__item"],declarations:{"border-width":tailorValidateUnit(to)}}]}},tailor_grid_item:{padding:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"],padding_tablet:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"],padding_mobile:[["&.tailor-grid__item"],"padding-{0}","tailorValidateUnit"]},tailor_tabs:{border_color:[[".tailor-tabs__navigation-item",".tailor-tab"],"border-color","tailorValidateColor"]},tailor_tab:{background_color:[["&.tailor-tabs__navigation-item","&.tailor-tab"],"background-color","tailorValidateColor"],padding:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],padding_tablet:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],padding_mobile:[["&.tailor-tab"],"padding-{0}","tailorValidateUnit"],border_width:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[["&.tailor-tab"],"border-{0}-width","tailorValidateUnit"],background_repeat:[["&.tailor-tab"],"background-repeat","tailorValidateString"],background_position:[["&.tailor-tab"],"background-position","tailorValidateString"],background_size:[["&.tailor-tab"],"background-size","tailorValidateString"],background_attachment:[["&.tailor-tab"],"background-attachment","tailorValidateString"]},tailor_toggle:{border_color:[[".tailor-toggle__title",".tailor-toggle__body"],"border-color","tailorValidateColor"],border_style:[[".tailor-toggle__title",".tailor-toggle__body"],"border-style","tailorValidateString"],border_radius:[[".tailor-toggle__title",".tailor-toggle__body"],"border-radius","tailorValidateUnit"]},tailor_section:{max_width:[[".tailor-section__content"],"max-width","tailorValidateUnit"],max_width_tablet:[[".tailor-section__content"],"max-width","tailorValidateUnit"],max_width_mobile:[[".tailor-section__content"],"max-width","tailorValidateUnit"],min_height:[[".tailor-section__content"],"min-height","tailorValidateUnit"],min_height_tablet:[[".tailor-section__content"],"min-height","tailorValidateUnit"],min_height_mobile:[[".tailor-section__content"],"min-height","tailorValidateUnit"]}};function getDefinition(tag,id,definition){if(window.Tailor.Settings.overrides["*"].hasOwnProperty(id)){return window.Tailor.Settings.overrides["*"][id]}if(window.Tailor.Settings.overrides.hasOwnProperty(tag)&&window.Tailor.Settings.overrides[tag].hasOwnProperty(id)){return window.Tailor.Settings.overrides[tag][id]}return definition}function registerCallbacks(definitions){_.each(definitions,function(definition,id){SettingAPI.onChange("element:"+id,function(to,from,model){definition=getDefinition(model.get("tag"),id,definition);if("function"==typeof definition){return definition.call(this,to,from,model)}if(""==to){return[]}var rule={media:getMediaQuery(id),selectors:definition[0],declarations:{}};if("function"==typeof window[definition[2]]){rule.declarations[definition[1]]=window[definition[2]](to)}else{rule.declarations[definition[1]]=to}return[rule]})})}_.each(["horizontal_alignment","horizontal_alignment_tablet","horizontal_alignment_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){var media=getMediaQuery(id);if(""!=media){media="-"+media}if(from){this.el.classList.remove("u-text-"+from+media)}this.el.classList.add("u-text-"+to+media);if("tailor_list_item"==model.get("tag")){var atts=model.get("atts");if(!_.isEmpty(atts["graphic_background_color"])||!_.isEmpty(atts["graphic_background_color_hover"])){return[{selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==to?"0":"1em","padding-right":"right"==to?"1em":"0"}}]}else{return[{selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}}]}}})});_.each(["vertical_alignment","vertical_alignment_tablet","vertical_alignment_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){var media=getMediaQuery(id);if(""!==media){media="-"+media}if(from){this.el.classList.remove("u-align-"+from+media)}this.el.classList.add("u-align-"+to+media)})});_.each(["size","size_tablet","size_mobile"],function(id){SettingAPI.onChange("element:"+id,function(to,from,model){if("tailor_button"==model.get("tag")){var media=getMediaQuery(id);if(""!=media){media="-"+media}if(from){this.el.classList.remove("tailor-button--"+from+media)}this.el.classList.add("tailor-button--"+to+media)}})});registerCallbacks({width:[[],"width","tailorValidateUnit"],width_tablet:[[],"width","tailorValidateUnit"],width_mobile:[[],"width","tailorValidateUnit"],max_width:[[],"max-width","tailorValidateUnit"],max_width_tablet:[[],"max-width","tailorValidateUnit"],max_width_mobile:[[],"max-width","tailorValidateUnit"],min_height:[[],"min-height","tailorValidateUnit"], +min_height_tablet:[[],"min-height","tailorValidateUnit"],min_height_mobile:[[],"min-height","tailorValidateUnit"],min_item_height:[[".tailor-grid__item"],"min-height","tailorValidateUnit"]});registerCallbacks({color:[[],"color","tailorValidateColor"],color_hover:[[":hover"],"color","tailorValidateColor"],link_color:[["a"],"color","tailorValidateColor"],link_color_hover:[["a:hover"],"color","tailorValidateColor"],heading_color:[["h1","h2","h3","h4","h5","h6"],"color","tailorValidateColor"],background_color:function(to,from,model){var atts=model.get("atts");if(atts["background_image"]){return false}var definition=getDefinition(model.get("tag"),"background_color",[[],"background-color","tailorValidateColor"]);if("function"==typeof definition){return definition.call(this,to,from,model)}var rule={selectors:definition[0],declarations:{}};if("function"==typeof window[definition[2]]){rule.declarations[definition[1]]=window[definition[2]](to)}else{rule.declarations[definition[1]]=to}return[rule]},background_color_hover:[[":hover"],"background-color","tailorValidateColor"],border_color:[[],"border-color","tailorValidateColor"],border_color_hover:[[":hover"],"border-color","tailorValidateColor"],graphic_color:function(to,from,model){var tag=model.get("tag");if("tailor_box"==tag){return[{selectors:[".tailor-box__graphic"],declarations:{color:tailorValidateColor(to)}}]}else if("tailor_list_item"==tag){return[{selectors:[".tailor-list__graphic"],declarations:{color:tailorValidateColor(to)}}]}},graphic_color_hover:function(to,from,model){var tag=model.get("tag");if("tailor_box"==tag){return[{selectors:[".tailor-box__graphic:hover"],declarations:{color:tailorValidateColor(to)}}]}else if("tailor_list_item"==tag){return[{selectors:[".tailor-list__graphic:hover"],declarations:{color:tailorValidateColor(to)}}]}},graphic_background_color:function(to,from,model){var tag=model.get("tag");var rules=[];if("tailor_box"==tag){if(to){rules.push({selectors:[".tailor-box__graphic"],declarations:{"margin-bottom":"1em","background-color":tailorValidateColor(to),"text-align":"center"}})}}else if("tailor_list_item"==tag){var atts=model.get("atts");var alignment=atts["horizontal_alignment"];if(to){rules.push({selectors:[".tailor-list__graphic"],declarations:{"background-color":tailorValidateColor(to),"text-align":"center"}});rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{if(!_.isEmpty(atts["graphic_background_color_hover"])){rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}})}}}return rules},graphic_background_color_hover:function(to,from,model){var tag=model.get("tag");var rules=[];if("tailor_box"==tag){if(to){rules.push({selectors:[".tailor-box__graphic"],declarations:{"margin-bottom":"1em","text-align":"center"}});rules.push({selectors:[".tailor-box__graphic:hover"],declarations:{"background-color":tailorValidateColor(to)}})}}else if("tailor_list_item"==tag){var atts=model.get("atts");var alignment=atts["horizontal_alignment"];if(to){rules.push({selectors:[".tailor-list__graphic"],declarations:{"text-align":"center"}});rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}});rules.push({selectors:[".tailor-list__graphic:hover"],declarations:{"background-color":tailorValidateColor(to)}})}else{if(!_.isEmpty(atts["graphic_background_color"])){rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"right"==alignment?"0":"1em","padding-right":"right"==alignment?"1em":"0"}})}else{rules.push({selectors:[".tailor-list__body"],declarations:{"padding-left":"0","padding-right":"0"}})}}}return rules},title_color:[[".tailor-toggle__title"],"color","tailorValidateColor"],title_background_color:[[".tailor-toggle__title"],"background-color","tailorValidateColor"],navigation_color:function(to,from,model){return[{selectors:[".slick-active button:before"],declarations:{"background-color":tailorValidateColor(to)}},{selectors:[".slick-arrow:not( .slick-disabled )"],declarations:{color:tailorValidateColor(to)}}]}});registerCallbacks({class:function(to,from,model){var classNames;if(!_.isEmpty(from)){classNames=from.trim().split(/\s+(?!$)/g);for(var i in classNames){if(classNames.hasOwnProperty(i)){this.el.classList.remove(classNames[i])}}}if(!_.isEmpty(to)){classNames=to.trim().split(/\s+(?!$)/g);for(var j in classNames){if(classNames.hasOwnProperty(j)){this.el.classList.add(classNames[j])}}}},border_style:[[],"border-style","tailorValidateString"],border_radius:[[],"border-radius","tailorValidateUnit"],background_repeat:[[],"background-repeat","tailorValidateString"],background_position:[[],"background-position","tailorValidateString"],background_size:[[],"background-size","tailorValidateString"],background_attachment:[[],"background-attachment","tailorValidateString"],shadow:function(to,from,model){var definition=getDefinition(model.get("tag"),"shadow",[[]]);if("function"==typeof definition){return definition.call(this,to,from,model)}if(1==to){return[{selectors:definition[0],declarations:{"box-shadow":"0 2px 6px rgba(0, 0, 0, 0.1)"}}]}return[]}});_.each({margin:[[],"margin-{0}","tailorValidateUnit"],margin_tablet:[[],"margin-{0}","tailorValidateUnit"],margin_mobile:[[],"margin-{0}","tailorValidateUnit"],padding:[[],"padding-{0}","tailorValidateUnit"],padding_tablet:[[],"padding-{0}","tailorValidateUnit"],padding_mobile:[[],"padding-{0}","tailorValidateUnit"],border_width:[[],"border-{0}-width","tailorValidateUnit"],border_width_tablet:[[],"border-{0}-width","tailorValidateUnit"],border_width_mobile:[[],"border-{0}-width","tailorValidateUnit"]},function(definition,id){SettingAPI.onChange("element:"+id,function(to,from,model){definition=getDefinition(model.get("tag"),id,definition);if("function"==typeof definition){return definition.call(this,to,from,model)}var rules=[];var rule={media:getMediaQuery(id),selectors:definition[0],declarations:{}};_.each(getStyleValues(to),function(value,position){if("function"==typeof window[definition[3]]){rule.declarations[definition[1].replace("{0}",position)]=window[definition[2]](value)}else{rule.declarations[definition[1].replace("{0}",position)]=value}});if(_.keys(rule.declarations).length>0){rules.push(rule)}return rules})})})})(window,window.app,window.Tailor.Api.Setting)},{}],49:[function(require,module,exports){window.tailorValidateString=function(string){return string.replace(/[0-9]/g,"")};window.tailorValidateNumber=function(string){string=string.replace(/[^0-9,.]+/i,"");return!_.isEmpty(string)?string:"0"};window.tailorValidateColor=function(color){if(/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(color)){return color}if(isRGBA(color)){return color}return""};function isRGBA(color){return/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d*(?:\.\d+)?)\)$/.test(color)}window.tailorValidateUnit=function(value){var sign="";if("-"==value.charAt(0)){sign="-";value=value.substring(1)}return sign+tailorValidateNumber(value)+getUnit(value)};function getUnit(string){var map=["px","%","in","cm","mm","pt","pc","em","rem","ex","vw","vh"];var matches=string.match(new RegExp(map.join("|")));if(matches){return matches[0]}return"px"}},{}],50:[function(require,module,exports){var $=window.jQuery,$win=$(window),app=window.app,cssModule,callbacks={sidebar:[],element:[]};function checkQuery(query){if(!query||!_.contains(_.keys(cssModule.stylesheets),query)){query="all"}return query}var onSidebarChange=function(setting){var settingId=setting.get("id");if(_.isEmpty(callbacks["sidebar"][settingId])){return}_.each(callbacks["sidebar"][settingId],function(callback){callback.apply(window,[setting.get("value"),setting.previous("value")])});$win.trigger("resize")};var onElementChange=function(setting,view){var elementId=view.model.get("id");var settingId=setting.get("id");if(!callbacks["element"].hasOwnProperty(settingId)||0==callbacks["element"][settingId].length){return}if(1==callbacks["element"][settingId].length){cssModule.deleteRules(elementId,settingId)}var ruleSets={};var rules;_.each(callbacks["element"][settingId],function(callback){if("function"==typeof callback){rules=callback.apply(view,[setting.get("value"),setting.previous("value"),view.model]);if(false===rules){view.model.trigger("change:atts",view.model,view.model.get("atts"))}else if(_.isArray(rules)&&rules.length>0){for(var rule in rules){if(rules.hasOwnProperty(rule)){if(!rules[rule].hasOwnProperty("selectors")||!rules[rule].hasOwnProperty("declarations")){continue}var query=checkQuery(rules[rule].media);ruleSets[query]=ruleSets[query]||{};ruleSets[query][elementId]=ruleSets[query][elementId]||[];if(_.keys(rules[rule].declarations).length>0){ruleSets[query][elementId].push({selectors:rules[rule].selectors,declarations:rules[rule].declarations,setting:rules[rule].setting||settingId})}}}cssModule.addRules(ruleSets)}}})};app.listenTo(app.channel,"sidebar:setting:change",onSidebarChange);app.listenTo(app.channel,"element:setting:change",onElementChange);app.channel.on("module:css:stylesheets:ready",function(module){cssModule=module});function registerCallback(type,id,callback){if("function"===typeof callback){callbacks[type][id]=callbacks[type][id]||[];callbacks[type][id].push(callback)}}module.exports={onChange:function(id,callback){var parts=id.split(":");if(parts.length>=2&&_.contains(["sidebar","element"],parts[0])){registerCallback(parts[0],parts[1],callback)}}}},{}],51:[function(require,module,exports){var DraggableBehaviors=Marionette.Behavior.extend({events:{dragstart:"onDragStart",dragend:"onDragEnd",drag:"onDrag"},onDragStart:function(e){app.channel.trigger("canvas:dragstart",e.originalEvent,this.view)},onDrag:function(e){app.channel.trigger("canvas:drag",e.originalEvent,this.view)},onDragEnd:function(e){app.channel.trigger("canvas:dragend",e.originalEvent,this.view)}});module.exports=DraggableBehaviors},{}],52:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],53:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],54:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],55:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],56:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],58:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],59:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},onInitialize:function(){var self=this;var initial=self.options.initial-1;if(initial<=0){initial=false}var accordionOverrideCallback=function(){};if(self.options.accordion){accordionOverrideCallback=self.allowMultiplePanesOpen}this.$el.accordion({header:".tailor-toggle .tailor-toggle__title",collapsible:true,active:initial,animate:self.options.speed,beforeActivate:accordionOverrideCallback})},onDestroy:function(e){this.$el.accordion("destroy")},onChangeChild:function(){this.$el.accordion("destroy");this.onInitialize()},allowMultiplePanesOpen:function(event,ui){if(ui.newHeader[0]){var currHeader=ui.newHeader;var currContent=currHeader.next(".ui-accordion-content")}else{var currHeader=ui.oldHeader;var currContent=currHeader.next(".ui-accordion-content")}var isPanelSelected=currHeader.attr("aria-selected")=="true";currHeader.toggleClass("ui-corner-all",isPanelSelected).toggleClass("accordion-header-active ui-state-active ui-corner-top",!isPanelSelected).attr("aria-selected",(!isPanelSelected).toString());currHeader.children(".ui-icon").toggleClass("ui-icon-triangle-1-e",isPanelSelected).toggleClass("ui-icon-triangle-1-s",!isPanelSelected);currContent.toggleClass("accordion-content-active",!isPanelSelected);if(isPanelSelected){currContent.slideUp()}else{currContent.slideDown()}return false}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],60:[function(require,module,exports){var $=jQuery,Ajax;Ajax={url:window.ajaxurl,post:function(action,data){return ajax.send({data:_.isObject(action)?action:_.extend(data||{},{action:action})})},send:function(action,options){if(_.isObject(action)){options=action}else{options=options||{};options.data=_.extend(options.data||{},{action:action,tailor:1})}options=_.defaults(options||{},{type:"POST",url:ajax.url,context:this});return $.Deferred(function(deferred){if(options.success){deferred.done(options.success)}var onError=options.error?options.error:ajax.onError;deferred.fail(onError);delete options.success;delete options.error;$.ajax(options).done(function(response){if(response==="1"||response===1){response={success:true}}if(_.isObject(response)&&!_.isUndefined(response.success)){ +deferred[response.success?"resolveWith":"rejectWith"](this,[response.data])}else{deferred.rejectWith(this,[response])}}).fail(function(){deferred.rejectWith(this,arguments)})}).promise()},onError:function(response){if(!Tailor.Notify){console.error(response);return}if(response&&response.hasOwnProperty("message")){Tailor.Notify(response.message)}else if("0"==response){Tailor.Notify(window._l10n.expired)}else if("-1"==response){Tailor.Notify(window._l10n.invalid)}else{Tailor.Notify(window._l10n.error)}}};window.ajax=Ajax;module.exports=Ajax},{}],61:[function(require,module,exports){var CSS={addRule:function(sheet,selector,declaration,index){if("insertRule"in sheet){sheet.insertRule(selector+" {"+declaration+"}",sheet.cssRules.length)}else if("addRule"in sheet){sheet.addRule(selector,declaration,sheet.cssRules.length)}},deleteRule:function(sheet,index){if("deleteRule"in sheet){sheet.deleteRule(index)}else if("removeRule"in sheet){sheet.removeRule(index)}},parseSelectors:function(selectors,elementId){if(_.isString(selectors)){return selectors}var elementClass=elementId?".tailor-"+elementId:"";var prefix=".tailor-ui ";if(!selectors.length){return prefix+elementClass}selectors=selectors.map(function(selector){if(selector.indexOf("&")>-1){selector=selector.replace("&",elementClass)}else{var firstCharacter=selector.charAt(0);if(":"==firstCharacter||"::"==firstCharacter){selector=elementClass+selector}else{selector=elementClass+" "+selector}}return prefix+selector});return selectors.join(",")},parseDeclarations:function(declarations){if(_.isString(declarations)){return declarations}var declaration="";_.each(declarations,function(value,property){declaration+=property+":"+value+";"});return declaration}};module.exports=CSS},{}],62:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;i'};options.dots=true}$el.tailorSlideshow(options)});$(".is-lightbox-gallery").each(function(){var $el=$(this);if($el.hasClass("tailor-carousel")){$el.tailorLightbox({delegate:".slick-slide:not( .slick-cloned ) .is-lightbox-image"})}else{$el.tailorLightbox()}});$(".is-lightbox-image").tailorLightbox({delegate:false})}};window.Tailor.Components.Abstract=abstractComponent;window.Tailor.Components.Lightbox=require("./shared/components/ui/lightbox");window.Tailor.Components.Map=require("./shared/components/ui/map");window.Tailor.Components.Masonry=require("./shared/components/ui/masonry");window.Tailor.Components.Parallax=require("./shared/components/ui/parallax");window.Tailor.Components.Slideshow=require("./shared/components/ui/slideshow");window.Tailor.Components.Tabs=require("./shared/components/ui/tabs");window.Tailor.Components.Toggles=require("./shared/components/ui/toggles");require("./frontend/components/ui/carousel");$(document).ready(function(){window.Tailor.initElements()})},{"./frontend/components/ui/carousel":2,"./shared/components/ui/abstract":3,"./shared/components/ui/lightbox":4,"./shared/components/ui/map":5,"./shared/components/ui/masonry":6,"./shared/components/ui/parallax":7,"./shared/components/ui/slideshow":8,"./shared/components/ui/tabs":9,"./shared/components/ui/toggles":10,"./shared/utility/polyfills/classlist":11,"./shared/utility/polyfills/raf":12,"./shared/utility/polyfills/transitions":13}],2:[function(require,module,exports){var $=window.jQuery,Carousel;Carousel=function(el,options,callbacks){this.el=el;this.$el=$(el);this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.options=$.extend(this.defaults,options,this.$el.data());if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.callbacks=$.extend(this.callbacks,callbacks);this.initialize()};Carousel.prototype={defaults:{items:"> .tailor-carousel__item",speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:false,adaptiveHeight:true,draggable:true,infinite:false,prevArrow:'',nextArrow:''},callbacks:{onInitialize:function(){},onDestroy:function(){}},initialize:function(){this.$items=this.$wrap.find(this.options.items);this.slick();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},slick:function(){this.$wrap.slick(this.options)},unSlick:function(){this.$wrap.slick("unslick")},destroy:function(e){this.unSlick();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}}};$.fn.tailorCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorCarousel");if(!instance){$.data(this,"tailorCarousel",new Carousel(this,options,callbacks))}})}},{}],3:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],4:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],5:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],6:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],7:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],9:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],10:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},initialize:function(){var self=this;var initial=self.options.initial-1;if(initial<=0){initial=false}var accordionOverrideCallback=function(){};if(self.options.accordion){accordionOverrideCallback=self.allowMultiplePanesOpen}this.$el.accordion({header:".tailor-toggle .tailor-toggle__title",collapsible:true,active:initial,animate:self.options.speed,beforeActivate:accordionOverrideCallback})},allowMultiplePanesOpen:function(event,ui){if(ui.newHeader[0]){var currHeader=ui.newHeader;var currContent=currHeader.next(".ui-accordion-content")}else{var currHeader=ui.oldHeader;var currContent=currHeader.next(".ui-accordion-content")}var isPanelSelected=currHeader.attr("aria-selected")=="true";currHeader.toggleClass("ui-corner-all",isPanelSelected).toggleClass("accordion-header-active ui-state-active ui-corner-top",!isPanelSelected).attr("aria-selected",(!isPanelSelected).toString());currHeader.children(".ui-icon").toggleClass("ui-icon-triangle-1-e",isPanelSelected).toggleClass("ui-icon-triangle-1-s",!isPanelSelected);currContent.toggleClass("accordion-content-active",!isPanelSelected);if(isPanelSelected){currContent.slideUp()}else{currContent.slideDown()}return false}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],11:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;i'};options.dots=true}$el.tailorSlideshow(options)});$(".is-lightbox-gallery").each(function(){var $el=$(this);if($el.hasClass("tailor-carousel")){$el.tailorLightbox({delegate:".slick-slide:not( .slick-cloned ) .is-lightbox-image"})}else{$el.tailorLightbox()}});$(".is-lightbox-image").tailorLightbox({delegate:false})}};window.Tailor.Components.Abstract=abstractComponent;window.Tailor.Components.Lightbox=require("./shared/components/ui/lightbox");window.Tailor.Components.Map=require("./shared/components/ui/map");window.Tailor.Components.Masonry=require("./shared/components/ui/masonry");window.Tailor.Components.Parallax=require("./shared/components/ui/parallax");window.Tailor.Components.Slideshow=require("./shared/components/ui/slideshow");window.Tailor.Components.Tabs=require("./shared/components/ui/tabs");window.Tailor.Components.Toggles=require("./shared/components/ui/toggles");require("./frontend/components/ui/carousel");$(document).ready(function(){window.Tailor.initElements()})},{"./frontend/components/ui/carousel":2,"./shared/components/ui/abstract":3,"./shared/components/ui/lightbox":4,"./shared/components/ui/map":5,"./shared/components/ui/masonry":6,"./shared/components/ui/parallax":7,"./shared/components/ui/slideshow":8,"./shared/components/ui/tabs":9,"./shared/components/ui/toggles":10,"./shared/utility/polyfills/classlist":11,"./shared/utility/polyfills/raf":12,"./shared/utility/polyfills/transitions":13}],2:[function(require,module,exports){var $=window.jQuery,Carousel;Carousel=function(el,options,callbacks){this.el=el;this.$el=$(el);this.$wrap=this.$el.find(".tailor-carousel__wrap").first();this.options=$.extend(this.defaults,options,this.$el.data());if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.callbacks=$.extend(this.callbacks,callbacks);this.initialize()};Carousel.prototype={defaults:{items:"> .tailor-carousel__item",speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:false,adaptiveHeight:true,draggable:true,infinite:false,prevArrow:'',nextArrow:''},callbacks:{onInitialize:function(){},onDestroy:function(){}},initialize:function(){this.$items=this.$wrap.find(this.options.items);this.slick();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},slick:function(){this.$wrap.slick(this.options)},unSlick:function(){this.$wrap.slick("unslick")},destroy:function(e){this.unSlick();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}}};$.fn.tailorCarousel=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorCarousel");if(!instance){$.data(this,"tailorCarousel",new Carousel(this,options,callbacks))}})}},{}],3:[function(require,module,exports){var $=window.jQuery,$win=$(window),$doc=$(document),AbstractComponent,id=0;AbstractComponent=function(el,options,callbacks){this.id="tailor"+id++;this.el=el;this.$el=$(this.el);this.callbacks=$.extend({},this.callbacks,callbacks);this.options=$.extend({},this.getDefaults(),this.$el.data(),options);if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.options.rtl=true}this.initialize()};AbstractComponent.prototype={callbacks:{onInitialize:function(){},onDestroy:function(){}},getDefaults:function(){return{}},initialize:function(){this.addEventListeners();this.onInitialize();if("function"==typeof this.callbacks.onInitialize){this.callbacks.onInitialize.call(this)}},addEventListeners:function(){var component=this;this.onResizeCallback=_.throttle(this.onResize.bind(this),100);this.$el.on("before:element:ready."+component.id,function(e,view){if(e.target==component.el){component.onBeforeReady(e,view)}}).on("element:ready."+component.id,function(e,view){if(e.target==component.el){component.onReady(e,view)}});this.$el.on("element:change:order."+component.id+" element:change:parent."+component.id,function(e,view){if(e.target==component.el){component.onMove(e,view)}});this.$el.on("before:element:copy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeCopy(e,view)}}).on("element:copy."+component.id,function(e,view){if(e.target==component.el){component.onCopy(e,view)}});this.$el.on("before:element:refresh."+component.id,function(e,view){if(e.target==component.el){component.destroy();component.onBeforeRefresh(e,view)}});this.$el.on("before:element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onBeforeJSRefresh(e,view)}}).on("element:jsRefresh."+component.id,function(e,view){if(e.target==component.el){component.onJSRefresh(e,view)}});this.$el.on("before:element:destroy."+component.id,function(e,view){if(e.target==component.el){component.onBeforeDestroy(e,view)}}).on("element:destroy."+component.id,function(e,view){if(e.target==component.el){component.destroy()}});this.$el.on("element:child:add."+component.id,function(e,view){if(e.target==component.el){component.onAddChild(e,view)}});this.$el.on("element:child:remove."+component.id,function(e,view){if(e.target==component.el){component.onRemoveChild(e,view)}});this.$el.on("before:element:child:ready."+component.id,function(e,view){component.onBeforeReadyChild(e,view)}).on("element:child:ready."+component.id,function(e,view){component.onReadyChild(e,view)});this.$el.on("element:child:change:order."+component.id+" element:child:change:parent."+component.id,function(e,view){component.onMoveChild(e,view)});this.$el.on("before:navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onBeforeReorderChild(e,cid,index,oldIndex)}).on("navigation:reorder."+component.id,function(e,cid,index,oldIndex){component.onReorderChild(e,cid,index,oldIndex);component.onReorderChild(e,cid,index,oldIndex)});this.$el.on("before:element:child:refresh."+component.id,function(e,view){component.onBeforeRefreshChild(e,view)}).on("element:child:refresh."+component.id,function(e,view){component.onRefreshChild(e,view)});this.$el.on("before:element:child:jsRefresh."+component.id,function(e,view){component.onBeforeJSRefreshChild(e,view)}).on("element:child:jsRefresh."+component.id,function(e,view){component.onJSRefreshChild(e,view)});this.$el.on("before:element:child:destroy."+component.id,function(e,view){component.onBeforeDestroyChild(e,view)}).on("element:child:destroy."+component.id,function(e,view){component.onDestroyChild(e,view)});this.$el.on("element:child:add."+component.id+" "+"element:child:remove."+component.id+" "+"element:child:ready."+component.id+" "+"element:child:refresh."+component.id+" "+"element:child:jsRefresh."+component.id+" "+"element:child:destroy."+component.id,function(e,view){component.onChangeChild(e,view)});this.$el.on("element:descendant:add."+component.id,function(e,view){if(e.target!=component.el){component.onAddDescendant(e,view)}});this.$el.on("element:descendant:remove."+component.id,function(e,view){if(e.target!=component.el){component.onRemoveDescendant(e,view)}});this.$el.on("before:element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeReadyDescendant(e,view)}}).on("element:descendant:ready."+component.id,function(e,view){if(e.target!=component.el){component.onReadyDescendant(e,view)}});this.$el.on("before:element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeRefreshDescendant(e,view)}}).on("element:descendant:refresh."+component.id,function(e,view){if(e.target!=component.el){component.onRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeJSRefreshDescendant(e,view)}}).on("element:descendant:jsRefresh."+component.id,function(e,view){if(e.target!=component.el){component.onJSRefreshDescendant(e,view)}});this.$el.on("before:element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onBeforeDestroyDescendant(e,view)}}).on("element:descendant:destroy."+component.id,function(e,view){if(e.target!=component.el){component.onDestroyDescendant(e,view)}});this.$el.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){component.onChangeDescendant(e,view)});$doc.on("element:descendant:add."+component.id+" "+"element:descendant:remove."+component.id+" "+"element:descendant:ready."+component.id+" "+"element:descendant:destroy."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}}).on("element:refresh."+component.id+" "+"element:jsRefresh."+component.id+" "+"element:descendant:refresh."+component.id+" "+"element:descendant:jsRefresh."+component.id,function(e,view){if(e.target.contains(component.el)&&e.target!=component.el&&view.el!=component.el){component.onChangeParent()}});$win.on("resize."+component.id,component.onResizeCallback)},removeEventListeners:function(){this.$el.off("."+this.id);$win.off("resize."+this.id,this.onResizeCallback)},onInitialize:function(){},onBeforeReady:function(e,view){},onReady:function(e,view){},onMove:function(e,view){},onBeforeCopy:function(e,view){},onCopy:function(e,view){},onBeforeRefresh:function(e,view){},onBeforeJSRefresh:function(e,view){},onJSRefresh:function(e,view){},onBeforeDestroy:function(e,view){},destroy:function(){this.removeEventListeners();this.onDestroy();if("function"==typeof this.callbacks.onDestroy){this.callbacks.onDestroy.call(this)}},onDestroy:function(){},onAddChild:function(e,view){},onRemoveChild:function(e,view){},onBeforeReadyChild:function(e,view){},onReadyChild:function(e,view){},onMoveChild:function(e,view){},onBeforeReorderChild:function(e,index,oldIndex){},onReorderChild:function(e,index,oldIndex){},onBeforeRefreshChild:function(e,view){},onRefreshChild:function(e,view){},onBeforeJSRefreshChild:function(e,view){},onJSRefreshChild:function(e,view){},onBeforeDestroyChild:function(e,view){},onDestroyChild:function(e,view){},onChangeChild:function(e,view){},onAddDescendant:function(e,view){},onRemoveDescendant:function(e,view){},onBeforeReadyDescendant:function(e,view){},onReadyDescendant:function(e,view){},onBeforeRefreshDescendant:function(e,view){},onRefreshDescendant:function(e,view){},onBeforeJSRefreshDescendant:function(e,view){},onJSRefreshDescendant:function(e,view){},onBeforeDestroyDescendant:function(e,view){},onDestroyDescendant:function(e,view){},onChangeDescendant:function(e,view){},onChangeParent:function(){},onResize:function(e,view){}};module.exports=AbstractComponent},{}],4:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Lightbox;Lightbox=Components.create({getDefaults:function(){return{type:"image",delegate:".is-lightbox-image",closeMarkup:'',gallery:{enabled:true,arrowMarkup:''},image:{titleSrc:function(item){return item.el.find("figcaption").text()}}}},onInitialize:function(){this.magnificPopup()},magnificPopup:function(){this.$el.magnificPopup(this.options)}});$.fn.tailorLightbox=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorLightbox");if(!instance){$.data(this,"tailorLightbox",new Lightbox(this,options,callbacks))}})};module.exports=Lightbox},{}],5:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Map;Map=Components.create({getDefaults:function(){return{height:450,address:"",latitude:"",longitude:"",zoom:12,draggable:1,scrollwheel:0,controls:0,hue:null,saturation:0}},getStyles:function(saturation,hue){return[{featureType:"all",elementType:"all",stylers:[{saturation:saturation?saturation:null},{hue:hue?hue:null}]},{featureType:"water",elementType:"all",stylers:[{hue:hue?hue:null},{saturation:saturation?saturation:null},{lightness:50}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"simplified"}]}]},onInitialize:function(){var component=this;this.markers=[];this.infoWindows=[];this.$canvas=this.$el.find(".tailor-map__canvas").height(this.options.height);this.getCoordinates(this.options).then(function(coordinates){component.center=coordinates;var controls=component.options.controls;var settings={zoom:component.options.zoom,draggable:component.options.draggable,scrollwheel:component.options.scrollwheel,center:coordinates,mapTypeId:google.maps.MapTypeId.ROADMAP,disableDefaultUI:!controls,panControl:controls,rotateControl:controls,scaleControl:controls,zoomControl:controls,mapTypeControl:controls,mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR,position:google.maps.ControlPosition.TOP_CENTER}};var styles=component.getStyles(component.options.saturation,component.options.hue);component.map=new google.maps.Map(component.$canvas[0],settings);component.map.mapTypes.set("map_style",new google.maps.StyledMapType(styles,{name:"Styled Map"}));component.map.setMapTypeId("map_style");component.setupMarkers(component.$el,component.map)})},getCoordinates:function(options){return $.Deferred(function(deferred){if("undefined"==typeof google){deferred.reject(new Error("The Google Maps API is currently unavailable"))}else if(""!=options.address){var geocoder=new google.maps.Geocoder;geocoder.geocode({address:options.address},function(results,status){if(google.maps.GeocoderStatus.OK==status){deferred.resolve(results[0].geometry.location)}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error(status))}})}else if(options.latitude&&options.longitude){deferred.resolve(new google.maps.LatLng(options.latitude,options.longitude))}else{deferred.reject(new Error("No address or map coordinates provided"))}}).promise()},setupMarkers:function($el,googleMap){var map=this;this.$el.find(".tailor-map__marker").each(function(index,el){var defaults={address:"",latitude:"",longitude:"",image:""};var settings=_.extend({},defaults,$(el).data());map.getCoordinates(settings).then(function(coordinates){map.markers[index]=new google.maps.Marker({map:googleMap,position:coordinates,infoWindowIndex:index,icon:settings.image});if("null"!=el.innerHTML){map.infoWindows[index]=new google.maps.InfoWindow({content:el.innerHTML});google.maps.event.addListener(map.markers[index],"click",function(){if(el.innerHTML){map.infoWindows[index].open(googleMap,this)}})}})})},refreshMap:function(){if(this.map){google.maps.event.trigger(this.map,"resize");this.map.setCenter(this.center)}},onMove:function(){this.refreshMap()},onRefresh:function(){this.refreshMap()},onChangeParent:function(){this.refreshMap()},onDestroy:function(){delete this.map;delete this.markers;delete this.infoWindows},onResize:function(){this.refreshMap()}});$.fn.tailorGoogleMap=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorGoogleMap");if(!instance){$.data(this,"tailorGoogleMap",new Map(this,options,callbacks))}})};module.exports=Map},{}],6:[function(require,module,exports){var $=window.jQuery,Components=window.Tailor.Components,Masonry;Masonry=Components.create({shuffleActive:false,getDefaults:function(){return{itemSelector:".tailor-grid__item"}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-grid--masonry");this.shuffle()},shuffle:function(){var component=this;this.$wrap.imagesLoaded(function(){component.$wrap.shuffle(component.options);component.shuffleActive=true})},refreshShuffle:function(){this.$wrap.shuffle("update")},unShuffle:function(){this.$wrap.shuffle("destroy");this.shuffleActive=false},onMove:function(){if(this.shuffleActive){this.refreshShuffle()}},onChangeParent:function(){if(this.shuffleActive){this.refreshShuffle()}},onDestroy:function(){if(this.shuffleActive){this.unShuffle()}},onResize:function(){if(this.shuffleActive){this.refreshShuffle()}}});$.fn.tailorMasonry=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorMasonry");if(!instance){$.data(this,"tailorMasonry",new Masonry(this,options,callbacks))}})};module.exports=Masonry},{}],7:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Parallax;Parallax=Components.create({getDefaults:function(){return{ratio:.25,selector:".tailor-section__background"}},onInitialize:function(){this.position={};this.background=this.el.querySelector(this.options.selector);if(!this.background){return}this.addEvents();this.refreshParallax()},addEvents:function(){this.onScrollCallback=this.onScroll.bind(this);$win.on("scroll."+this.id,this.onScrollCallback)},doSetup:function(){this.windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);var rect=this.el.getBoundingClientRect();var height=this.el.offsetHeight;var top=rect.top+window.pageYOffset;this.position.top=top;this.position.height=height;this.position.bottom=top+height;this.background.style.bottom="0px";this.background.style.height=Math.round(height+height*this.options.ratio)+"px"},doParallax:function(){if(!this.inViewport()){return}var amountScrolled=1-(this.position.bottom-window.pageYOffset)/(this.position.height+this.windowHeight);var translateY=Math.round(amountScrolled*this.position.height*this.options.ratio*100)/100;this.background.style[Modernizr.prefixed("transform")]="translate3d( 0px, "+translateY+"px, 0px )"},refreshParallax:function(){this.doSetup();this.doParallax()},inViewport:function(){var winTop=window.pageYOffset;var winBottom=winTop+this.windowHeight;return this.position.top',nextArrow:'',adaptiveHeight:true,draggable:false,speed:250,slidesToShow:1,slidesToScroll:1,autoplay:false,autoplaySpeed:3e3,arrows:false,dots:false,fade:true}},onInitialize:function(){this.$wrap=this.$el.find(".tailor-slideshow__slides");this.slick()},slick:function(){var component=this;this.$el.imagesLoaded(function(){component.$wrap.slick(component.options);component.slickActive=true})},refreshSlick:function(){if(this.slickActive){this.$wrap.slick("refresh")}},unSlick:function(){if(this.slickActive){this.$wrap.slick("unslick")}},onMove:function(){this.refreshSlick()},onBeforeCopy:function(){this.unSlick()},onChangeParent:function(){this.refreshSlick()},onDestroy:function(){this.unSlick()},onResize:function(){this.refreshSlick()}});$.fn.tailorSlideshow=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorSlideshow");if(!instance){$.data(this,"tailorSlideshow",new Slideshow(this,options,callbacks))}})}},{}],9:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Tabs;Tabs=Components.create({getDefaults:function(){return{tabs:".tailor-tabs__navigation .tailor-tabs__navigation-item",content:".tailor-tabs__content .tailor-tab",initial:1}},onInitialize:function(){this.querySelectors();this.setActive()},querySelectors:function(){if(this.$tabs){this.$tabs.off()}this.$content=this.$el.find(this.options.content);this.$tabs=this.$el.find(this.options.tabs).on("click",$.proxy(this.onClick,this))},setActive:function(){var active=this.$content.filter(function(){return this.classList.contains("is-active")});var el;if(0==active.length){var initial=this.options.initial-1;if(this.$content[initial]){el=this.$content[initial]}}else{el=active[0]}if(el){this.activate(el.id)}},activate:function(id){this.$tabs.each(function(){this.classList.toggle("is-active",this.getAttribute("data-id")==id)});this.$content.each(function(){$(this).toggle(this.id==id).toggleClass("is-active",this.id==id)});$win.trigger("resize")},refreshTabs:function(e,childView){this.querySelectors();this.activate(childView.el.id)},onClick:function(e){this.activate(e.target.getAttribute("data-id"));e.preventDefault()},onDestroy:function(){this.$tabs.off()},onAddChild:function(e,childView){this.refreshTabs(e,childView)},onReadyChild:function(e,childView){this.refreshTabs(e,childView)},onRemoveChild:function(e,childView){this.refreshTabs(e,childView)},onRefreshChild:function(e,childView){this.refreshTabs(e,childView)},onReorderChild:function(e,id,newIndex,oldIndex){this.activate(id)},onDestroyChild:function(e,childView){if(0==childView.$el.index()&&!childView.el.nextSibling){return}var id=childView.el.nextSibling?childView.el.nextSibling.id:childView.el.previousSibling.id;childView.$el.remove();this.querySelectors();this.activate(id)}});$.fn.tailorTabs=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorTabs");if(!instance){$.data(this,"tailorTabs",new Tabs(this,options,callbacks))}})};module.exports=Tabs},{}],10:[function(require,module,exports){var $=window.jQuery,$win=$(window),Components=window.Tailor.Components,Toggles;Toggles=Components.create({getDefaults:function(){return{toggles:".tailor-toggle__title",content:".tailor-toggle__body",accordion:false,initial:0,speed:150}},onInitialize:function(){var self=this;var initial=self.options.initial-1;if(initial<=0){initial=false}var accordionOverrideCallback=function(){};if(self.options.accordion){accordionOverrideCallback=self.allowMultiplePanesOpen}this.$el.accordion({header:".tailor-toggle .tailor-toggle__title",collapsible:true,active:initial,animate:self.options.speed,beforeActivate:accordionOverrideCallback})},onDestroy:function(e){this.$el.accordion("destroy")},onChangeChild:function(){this.$el.accordion("destroy");this.onInitialize()},allowMultiplePanesOpen:function(event,ui){if(ui.newHeader[0]){var currHeader=ui.newHeader;var currContent=currHeader.next(".ui-accordion-content")}else{var currHeader=ui.oldHeader;var currContent=currHeader.next(".ui-accordion-content")}var isPanelSelected=currHeader.attr("aria-selected")=="true";currHeader.toggleClass("ui-corner-all",isPanelSelected).toggleClass("accordion-header-active ui-state-active ui-corner-top",!isPanelSelected).attr("aria-selected",(!isPanelSelected).toString());currHeader.children(".ui-icon").toggleClass("ui-icon-triangle-1-e",isPanelSelected).toggleClass("ui-icon-triangle-1-s",!isPanelSelected);currContent.toggleClass("accordion-content-active",!isPanelSelected);if(isPanelSelected){currContent.slideUp()}else{currContent.slideDown()}return false}});$.fn.tailorToggles=function(options,callbacks){return this.each(function(){var instance=$.data(this,"tailorToggles");if(!instance){$.data(this,"tailorToggles",new Toggles(this,options,callbacks))}})};module.exports=Toggles},{}],11:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;i0){for(var rule in rules){if(rules.hasOwnProperty(rule)){if(!rules[rule].hasOwnProperty("selectors")||!rules[rule].hasOwnProperty("declarations")){continue}var query=checkQuery(rules[rule].media);ruleSets[query]=ruleSets[query]||{};ruleSets[query][elementId]=ruleSets[query][elementId]||[];if(_.keys(rules[rule].declarations).length>0){ruleSets[query][elementId].push({selectors:rules[rule].selectors,declarations:rules[rule].declarations,setting:rules[rule].setting||settingId})}}}cssModule.addRules(ruleSets)}}})};app.listenTo(app.channel,"sidebar:setting:change",onSidebarChange);app.listenTo(app.channel,"element:setting:change",onElementChange);app.channel.on("module:css:stylesheets:ready",function(module){cssModule=module});function registerCallback(type,id,callback){if("function"===typeof callback){callbacks[type][id]=callbacks[type][id]||[];callbacks[type][id].push(callback)}}module.exports={onChange:function(id,callback){var parts=id.split(":");if(parts.length>=2&&_.contains(["sidebar","element"],parts[0])){registerCallback(parts[0],parts[1],callback)}}}},{}],2:[function(require,module,exports){var DraggableBehaviors=Marionette.Behavior.extend({events:{dragstart:"onDragStart",dragend:"onDragEnd",drag:"onDrag"},onDragStart:function(e){app.channel.trigger("canvas:dragstart",e.originalEvent,this.view)},onDrag:function(e){app.channel.trigger("canvas:drag",e.originalEvent,this.view)},onDragEnd:function(e){app.channel.trigger("canvas:dragend",e.originalEvent,this.view)}});module.exports=DraggableBehaviors},{}],3:[function(require,module,exports){var $=jQuery,Ajax;Ajax={url:window.ajaxurl,post:function(action,data){return ajax.send({data:_.isObject(action)?action:_.extend(data||{},{action:action})})},send:function(action,options){if(_.isObject(action)){options=action}else{options=options||{};options.data=_.extend(options.data||{},{action:action,tailor:1})}options=_.defaults(options||{},{type:"POST",url:ajax.url,context:this});return $.Deferred(function(deferred){if(options.success){deferred.done(options.success)}var onError=options.error?options.error:ajax.onError;deferred.fail(onError);delete options.success;delete options.error;$.ajax(options).done(function(response){if(response==="1"||response===1){response={success:true}}if(_.isObject(response)&&!_.isUndefined(response.success)){deferred[response.success?"resolveWith":"rejectWith"](this,[response.data])}else{deferred.rejectWith(this,[response])}}).fail(function(){deferred.rejectWith(this,arguments)})}).promise()},onError:function(response){if(!Tailor.Notify){console.error(response);return}if(response&&response.hasOwnProperty("message")){Tailor.Notify(response.message)}else if("0"==response){Tailor.Notify(window._l10n.expired)}else if("-1"==response){Tailor.Notify(window._l10n.invalid)}else{Tailor.Notify(window._l10n.error)}}};window.ajax=Ajax;module.exports=Ajax},{}],4:[function(require,module,exports){var Notification;require("./polyfills/transitions");Notification=function(options){this.options=_.extend({},this.defaults,options);this.el=document.createElement("div");this.el.className="notification notification--"+this.options.type;this.container=document.getElementById("tailor-notification-container")||document.body;this.initialize()};Notification.prototype={defaults:{message:"",type:"",ttl:3e3,onShow:function(){},onHide:function(){}},initialize:function(){this.el.innerHTML=this.options.message;this.container.insertBefore(this.el,this.container.firstChild)},show:function(){var notification=this;notification.el.classList.add("is-visible");if("function"==typeof notification.options.onShow){notification.options.onShow.call(notification)}notification.session=setTimeout(function(){notification.hide()},notification.options.ttl)},hide:function(){var obj=this;var onTransitionEnd=function(e){if(Modernizr.cssanimations){if(e.target!==obj.el){return false}obj.el.removeEventListener(window.transitionEndName,onTransitionEnd)}obj.container.removeChild(obj.el);if("function"==typeof obj.options.onShow){obj.options.onShow.call(obj)}};clearTimeout(obj.session);if(Modernizr.csstransitions){obj.el.addEventListener(window.transitionEndName,onTransitionEnd);obj.el.classList.remove("is-visible")}else{onTransitionEnd()}}};var notify=function(msg,type){var notification=new Notification({message:msg,type:type||"error"});notification.show()};module.exports=notify},{"./polyfills/transitions":7}],5:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;iparseInt(required,10);case"contains":if(_.isString(actual)){actual=actual.split(",")}if(_.isArray(required)){var intersection=_.intersection(required,actual);return 0!==intersection.length}return-1!==_.indexOf(actual,required)}}}};wp.media.view.settings.post.id=window.post.id;app.addRegions({content:"#tailor-sidebar-content",dialog:{selector:"#tailor-dialog-container",regionClass:require("./sidebar/modules/dialog/dialog-region")},modal:{selector:"#tailor-modal-container",regionClass:require("./sidebar/modules/modal/modal-region")}});Tailor.Models.Container=require("./sidebar/entities/models/element-container");Tailor.Models.Wrapper=require("./sidebar/entities/models/element-wrapper");Tailor.Models.Section=require("./sidebar/entities/models/element-wrapper");Tailor.Models.Default=require("./sidebar/entities/models/element");Tailor.Panels.Default=require("./sidebar/components/panels/panel-default");Tailor.Panels.Empty=require("./sidebar/components/panels/panel-empty");Tailor.Sections.Default=require("./sidebar/components/sections/section-default");Tailor.Controls.ButtonGroup=require("./sidebar/components/controls/button-group");Tailor.Controls.Checkbox=require("./sidebar/components/controls/checkbox");Tailor.Controls.Code=require("./sidebar/components/controls/code");Tailor.Controls.Colorpicker=require("./sidebar/components/controls/colorpicker");Tailor.Controls.Editor=require("./sidebar/components/controls/editor");Tailor.Controls.Gallery=require("./sidebar/components/controls/gallery");Tailor.Controls.Icon=require("./sidebar/components/controls/icon");Tailor.Controls.Image=require("./sidebar/components/controls/image");Tailor.Controls.InputGroup=require("./sidebar/components/controls/input-group");Tailor.Controls.Link=require("./sidebar/components/controls/link");Tailor.Controls.List=require("./sidebar/components/controls/list");Tailor.Controls.Radio=require("./sidebar/components/controls/radio");Tailor.Controls.Range=require("./sidebar/components/controls/range");Tailor.Controls.Select=require("./sidebar/components/controls/select");Tailor.Controls.SelectMulti=require("./sidebar/components/controls/select-multi");Tailor.Controls.Style=require("./sidebar/components/controls/style");Tailor.Controls.Switch=require("./sidebar/components/controls/switch");Tailor.Controls.Text=require("./sidebar/components/controls/text");Tailor.Controls.Textarea=require("./sidebar/components/controls/textarea");Tailor.Controls.Video=require("./sidebar/components/controls/video");Tailor.Controls.WidgetForm=require("./sidebar/components/controls/widget-form");Tailor.Controls.Default=require("./sidebar/components/controls/text");Tailor.Controls.Abstract=require("./sidebar/components/controls/abstract-control");function getName(string){string=string||"";return string.replace(/_|-|tailor_/gi," ").replace(/(?: |\b)(\w)/g,function(key){return key.toUpperCase().replace(/\s+/g,"")})}Tailor.lookup=function(tag,type,object){if(!Tailor.hasOwnProperty(object)){console.error("Object type "+object+" does not exist");return}var name=getName(tag);if(Tailor[object].hasOwnProperty(name)){return Tailor[object][name]}if(type){name=getName(type);if(Tailor[object].hasOwnProperty(name)){return Tailor[object][name]}}return Tailor[object].Default};app.on("start",function(options){app.module("module:library",require("./sidebar/modules/library/library"));app.module("module:templates",require("./sidebar/modules/templates/templates"));app.module("module:settings",require("./sidebar/modules/settings/settings"));app.module("module:history",require("./sidebar/modules/history/history"));app.module("module:sections",require("./sidebar/modules/sections/sections"));app.module("module:panels",require("./sidebar/modules/panels/panels"));app.module("module:modal",require("./sidebar/modules/modal/modal"));app.module("module:dialog",require("./sidebar/modules/dialog/dialog"));app.module("module:notification",require("./sidebar/modules/notifications/notifications"));app.module("module:devicePreview",require("./sidebar/modules/device-preview/device-preview"));require("./sidebar/preview");$doc.on("heartbeat-send",function(e,data){data["tailor_post_id"]=window.post.id});wp.heartbeat.interval(60);wp.heartbeat.connectNow();$win.on("beforeunload.tailor",function(e){if(app.hasUnsavedChanges()){return window._l10n.confirmPage}}).on("unload.tailor",function(e){window.ajax.send("tailor_unlock_post",{data:{post_id:options.postId,nonce:options.nonces.unlockPost}})})});$doc.ready(function(){app.start({postId:window.post.id,nonces:window._nonces,l10n:window._l10n||[],library:window._library||[],templates:window._templates||[],panels:window._panels||[],sections:window._sections||[],settings:window._settings||[],controls:window._controls||[]});app.channel.trigger("sidebar:initialize",app)})})(window,Backbone.$)},{"./shared/components/api/setting":1,"./shared/components/behaviors/draggable":2,"./shared/utility/ajax":3,"./shared/utility/notify":4,"./shared/utility/polyfills/classlist":5,"./shared/utility/polyfills/raf":6,"./shared/utility/polyfills/transitions":7,"./sidebar/app":9,"./sidebar/components/behaviors/panel":10,"./sidebar/components/behaviors/resizable":11,"./sidebar/components/controls/abstract-control":12,"./sidebar/components/controls/button-group":13,"./sidebar/components/controls/checkbox":14,"./sidebar/components/controls/code":15,"./sidebar/components/controls/colorpicker":16,"./sidebar/components/controls/editor":17,"./sidebar/components/controls/gallery":18,"./sidebar/components/controls/icon":19,"./sidebar/components/controls/image":20,"./sidebar/components/controls/input-group":21,"./sidebar/components/controls/link":22,"./sidebar/components/controls/list":25,"./sidebar/components/controls/radio":26,"./sidebar/components/controls/range":27,"./sidebar/components/controls/select":29,"./sidebar/components/controls/select-multi":28,"./sidebar/components/controls/style":30,"./sidebar/components/controls/switch":31,"./sidebar/components/controls/text":32,"./sidebar/components/controls/textarea":33,"./sidebar/components/controls/video":34,"./sidebar/components/controls/widget-form":35,"./sidebar/components/panels/panel-default":36,"./sidebar/components/panels/panel-empty":37,"./sidebar/components/sections/section-default":38,"./sidebar/entities/models/element":51,"./sidebar/entities/models/element-container":49,"./sidebar/entities/models/element-wrapper":50,"./sidebar/modules/device-preview/device-preview":56,"./sidebar/modules/dialog/dialog":58,"./sidebar/modules/dialog/dialog-region":57,"./sidebar/modules/history/history":60,"./sidebar/modules/library/library":62,"./sidebar/modules/modal/modal":65,"./sidebar/modules/modal/modal-region":64,"./sidebar/modules/notifications/notifications":73,"./sidebar/modules/panels/panels":74,"./sidebar/modules/sections/sections":79,"./sidebar/modules/settings/settings":81,"./sidebar/modules/templates/templates":84,"./sidebar/preview":85}],9:[function(require,module,exports){var $=Backbone.$,$doc=$(document),SidebarApplication;SidebarApplication=Marionette.Application.extend({el:document.querySelector("#tailor"),initialize:function(){this._collapsed=false;this._unsavedChanges=false;this.saveButton=document.querySelector("#tailor-save");this.allowableEvents=["canvas:initialize","element:add","element:move","element:resize","navigation:reorder","element:copy","element:delete","elements:restore","template:add","history:undo","history:redo","modal:open","modal:destroy"];this.addEventListeners()},hasUnsavedChanges:function(){return this._unsavedChanges},addEventListeners:function(){var sidebar=this;var events=["element:add","element:move","element:resize","navigation:reorder","element:copy","element:delete","modal:apply","template:add","sidebar:setting:change"];sidebar.listenTo(sidebar.channel,events.join(" "),function(){sidebar.saveButton.disabled=false;sidebar.saveButton.innerHTML=window._l10n.publish;sidebar._unsavedChanges=true});$("#tailor-collapse").on("click",function(){sidebar._collapsed=!sidebar._collapsed;sidebar.el.classList.toggle("is-collapsed",sidebar._collapsed);sidebar.saveButton.setAttribute("aria-expanded",!sidebar._collapsed);sidebar.triggerMethod("collapse:sidebar")});$(sidebar.saveButton).on("click",function(){sidebar.el.classList.add("is-saving");sidebar.saveButton.setAttribute("disabled",true);var models=sidebar.channel.request("canvas:elements");var settings=sidebar.channel.request("sidebar:settings");window.ajax.send("tailor_save",{data:{post_id:window.post.id,models:JSON.stringify(models.toJSON()),settings:JSON.stringify(settings.toJSON()),nonce:window._nonces.save},success:function(){sidebar.saveButton.disabled=true;sidebar.saveButton.innerHTML=window._l10n.saved;sidebar._unsavedChanges=false;sidebar.channel.trigger("sidebar:save")},error:function(response){sidebar.saveButton.disabled=false;if(response&&response.hasOwnProperty("message")){Tailor.Notify(response.message)}else if("0"==response){Tailor.Notify(window._l10n.expired)}else if("-1"==response){Tailor.Notify(window._l10n.invalid)}else{Tailor.Notify(window._l10n.error)}},complete:function(){sidebar.el.classList.remove("is-saving")}})});sidebar.listenTo(sidebar.channel,"canvas:handshake",sidebar.registerRemoteChannel);$doc.on("keydown",function(e){if(e.ctrlKey&&89==e.keyCode){if(!_.contains(["INPUT","SELECT","TEXTAREA"],e.target.tagName)){sidebar.channel.trigger("history:redo")}}});$doc.on("keydown",function(e){if(e.ctrlKey&&90==e.keyCode){if(!_.contains(["INPUT","SELECT","TEXTAREA"],e.target.tagName)){sidebar.channel.trigger("history:undo")}}})},registerRemoteChannel:function(){var sidebarApp=this;var iFrame=this.el.querySelector("#tailor-sidebar-preview");if(window.location.origin===iFrame.contentWindow.location.origin){var remoteChannel=iFrame.contentWindow.app.channel;app.channel.reply("canvas:elements",function(id){return remoteChannel.request("canvas:elements",id)});app.channel.reply("canvas:element:selected",function(){return remoteChannel.request("canvas:element:selected")});app.listenTo(remoteChannel,"all",sidebarApp.forwardRemoteEvent);app.el.classList.add("is-initialized");app.el.querySelector(".tailor-preview__viewport").classList.add("is-loaded")}},forwardRemoteEvent:function(eventName){if(_.contains(this.allowableEvents,eventName)){this.channel.trigger.apply(this.channel,arguments)}},maybeCollapse:function(e){if(13===e.keyCode){this.onCollapse()}},maybeSave:function(e){if(13===e.keyCode){this.onSave()}}});module.exports=SidebarApplication},{}],10:[function(require,module,exports){var PanelBehavior=Marionette.Behavior.extend({ui:{backButton:".back-button",helpButton:".help-button",helpDescription:".help-description",searchBar:".search"},events:{"click @ui.helpButton":"toggleHelp","change @ui.searchBar":"doSearch","input @ui.searchBar":"doSearch","keyup @ui.searchBar":"doSearch","search @ui.searchBar":"doSearch"},triggers:{"click @ui.backButton":"back"},toggleHelp:function(){this.ui.helpButton.toggleClass("is-open");this.ui.helpDescription.slideToggle(150)},doSearch:function(e){this.view.collection.doSearch(e.target.value)}});module.exports=PanelBehavior},{}],11:[function(require,module,exports){var ResizableBehavior=Marionette.Behavior.extend({ui:{handle:".modal__title"},events:{mousemove:"onMouseMove",mousedown:"onMouseDown","dblclick @ui.handle":"toggleFullScreen"},initialize:function(){this._isResizing=false;this._isResizing=false;this.$ghostPane=jQuery('
    ').appendTo("body");this.addEventListeners()},addEventListeners:function(){var behavior=this;window.addEventListener("resize",function(){behavior.checkPosition()},false)},detectEdges:function(e){var rect=this.el.getBoundingClientRect();var x=e.clientX-rect.left;var y=e.clientY-rect.top;var threshold=8;var edges=[];if(y=rect.height-threshold){edges.push("bottom")}if(x=rect.width-threshold){edges.push("right")}return edges},onMouseMove:function(e){if(this._isResizing||this._isDragging){return}this.$el.removeClass("top top-left top-right left right bottom bottom-left bottom-right is-draggable");var edges=this.detectEdges(e);if(edges.length&&!this.container.classList.contains("is-full-screen")&&!document.body.classList.contains("mce-fullscreen")){this.$el.addClass(edges.join("-"))}else if(e.target.classList.contains("modal__title")){this.el.classList.add("is-draggable")}},onMouseDown:function(e){if(this._isResizing||this._isDragging){return}var edges=this.detectEdges(e);if(edges.length&&!this.$container.hasClass("is-full-screen")&&!document.body.classList.contains("mce-fullscreen")){this.resize(e,edges)}else if(e.target===this.ui.handle.get(0)){this.drag(e)}},resize:function(e,edges){var that=this;var edge=edges.join("-");var direction=_.contains(edges,"top")||_.contains(edges,"left")?-1:1;this._isResizing=true;document.body.classList.add("is-dragging");document.addEventListener("mousemove",onResize,false);document.addEventListener("mouseup",onResizeEnd,false);var lastX=e.pageX;var lastY=e.pageY;var lastWidth=parseInt(that.container.style.width,10);var lastHeight=parseInt(that.container.style.height,10);function onResize(e){var xDifference=direction*(e.pageX-lastX);var yDifference=direction*(e.pageY-lastY);switch(edge){case"top":lastHeight=lastHeight+yDifference;if(lastHeight>400){that.container.style.height=lastHeight+"px";that.container.style.top=parseInt(that.container.style.top,10)-yDifference+"px"}break;case"bottom":lastHeight=lastHeight+yDifference;if(lastHeight>400){that.container.style.height=lastHeight+"px"}break;case"left":lastWidth=lastWidth+xDifference;if(lastWidth>300){that.container.style.width=lastWidth+"px";that.container.style.left=parseInt(that.container.style.left,10)-xDifference+"px"}break;case"right":lastWidth=lastWidth+xDifference;if(lastWidth>300){that.container.style.width=lastWidth+"px"}break;case"top-left":lastHeight=lastHeight+yDifference;lastWidth=lastWidth+xDifference;if(lastWidth>300){that.container.style.width=lastWidth+"px";that.container.style.left=parseInt(that.container.style.left,10)-xDifference+"px"}if(lastHeight>400){that.container.style.height=lastHeight+"px";that.container.style.top=parseInt(that.container.style.top,10)-yDifference+"px"}break;case"top-right":lastHeight=lastHeight+yDifference;lastWidth=lastWidth-xDifference;if(lastWidth>300){that.container.style.width=lastWidth+"px"}if(lastHeight>400){that.container.style.height=lastHeight+"px";that.container.style.top=parseInt(that.container.style.top,10)-yDifference+"px"}break;case"bottom-left":lastHeight=lastHeight-yDifference;lastWidth=lastWidth+xDifference;if(lastWidth>300){that.container.style.width=lastWidth+"px";that.container.style.left=parseInt(that.container.style.left,10)-xDifference+"px"}if(lastHeight>400){that.container.style.height=lastHeight+"px"}break;case"bottom-right":lastHeight=lastHeight+yDifference;lastWidth=lastWidth+xDifference;if(lastWidth>300){that.container.style.width=lastWidth+"px"}if(lastHeight>400){that.container.style.height=lastHeight+"px"}break}that.triggerResize(lastWidth,lastHeight);lastY=e.pageY;lastX=e.pageX}function onResizeEnd(e){that._isResizing=false;document.body.classList.remove("is-dragging");document.removeEventListener("mousemove",onResize,false);document.removeEventListener("mouseup",onResizeEnd,false);that.checkPosition(150)}},drag:function(e){var that=this;var lastX;var lastY;this._isDragging=true;document.addEventListener("mousemove",onDrag,false);document.addEventListener("mouseup",onDragEnd,false);function onDrag(e){document.body.classList.add("is-dragging");that.container.style.top=parseInt(that.container.style.top,10)+(e.pageY-lastY)+"px";that.container.style.left=parseInt(that.container.style.left,10)+(e.pageX-lastX)+"px";if(e.pageX<5){that.$ghostPane.css({display:"block"}).addClass("left")}else if(e.pageX>window.innerWidth-5){that.$ghostPane.css({display:"block"}).addClass("right")}else if(e.pageY<5){that.$ghostPane.css({display:"block"}).addClass("top")}else{that.resetGhostPane();if(that.container.classList.contains("is-full-screen")){that.$container.removeClass("is-full-screen is-full-screen-left is-full-screen-right");that.container.style.top=e.pageY-20+"px";that.container.style.left=e.pageX-parseInt(that.container.style.width,10)/2+"px";that.triggerResize(parseInt(that.container.style.width,10),parseInt(that.container.style.height,10))}}lastX=e.pageX;lastY=e.pageY}function onDragEnd(e){that._isDragging=false;document.body.classList.remove("is-dragging");document.removeEventListener("mousemove",onDrag,false);document.removeEventListener("mouseup",onDragEnd,false);that.maybeToggleFullScreen(e)}},maybeToggleFullScreen:function(e){var position;if(e.pageY<5){position="top"}else if(e.pageX<5){position="left"}else if(e.pageX>window.innerWidth-5){position="right"}if(position){this.enterFullScreen(position)}else{this.checkPosition(150)}},toggleFullScreen:function(){if(!this.container.classList.contains("is-full-screen")){this.enterFullScreen("top")}else{this.exitFullScreen()}},enterFullScreen:function(position){this.$container.removeClass("is-full-screen is-full-screen-left is-full-screen-right");this.container.classList.add("is-full-screen");this.container.classList.add("is-full-screen-"+position);var rect=this.container.getBoundingClientRect();this.triggerResize(rect.width,rect.height)},exitFullScreen:function(){this.$container.removeClass("is-full-screen is-full-screen-left is-full-screen-right");this.triggerResize(parseInt(this.container.style.width,10),parseInt(this.container.style.height,10));this.checkPosition(150);this.resetGhostPane()},triggerResize:function(width,height){this.view.trigger("modal:resize",width,height)},resetGhostPane:function(){this.$ghostPane.css({display:"none"});this.$ghostPane[0].className="ghost-pane"},onShow:function(){this.container=this.el.parentNode;this.$container=this.$el.parent();this.checkPosition()},checkPosition:function(duration){duration=duration||0;var width=parseInt(this.container.style.width,10);var height=parseInt(this.container.style.height,10);var top=parseInt(this.container.style.top,10);var left=parseInt(this.container.style.left,10);var css={};if(topwindow.scrollY+window.innerHeight){css.top=Math.max(window.scrollY+window.innerHeight-height,window.scrollY)}if(left<0){css.left=window.scrollX}else if(left+width>window.scrollX+window.innerWidth){css.left=Math.max(window.scrollX+window.innerWidth-width,window.scrollX)}if(duration){this.$container.animate(css,duration)}else{this.$container.css(css)}},onDestroy:function(){this.$ghostPane.remove()}});module.exports=ResizableBehavior},{}],12:[function(require,module,exports){var $=window.jQuery,AbstractControl;AbstractControl=Marionette.ItemView.extend({tagName:"li",media:"desktop",ui:{input:"input",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"blur @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},className:function(){return"control control--"+this.model.get("type")},getTemplate:function(){return"#tmpl-tailor-control-"+this.model.get("type")},serializeData:function(){var data=Backbone.Marionette.ItemView.prototype.serializeData.apply(this,arguments);data.values=this.getValues();data.hideDefault=this.checkDefault(data.values);data=this.addSerializedData(data);return data},addSerializedData:function(data){return data},checkDefault:function(values){var hide=true;_.each(this.getDefaults(),function(value,media){if(!_.isNull(value)&&values.hasOwnProperty(media)&&!_.isNull(values[media])&&value!==values[media]){hide=false}});return hide},initialize:function(){this.addEventListeners();this.checkDependencies()},addEventListeners:function(){_.each(this.getSettings(),function(setting){this.listenTo(setting,"change",this.onSettingChange)},this);this.listenTo(this.getSetting().collection,"change",this.checkDependencies)},checkDependencies:function(setting){setting=setting||this.getSetting();var dependencies=this.model.get("dependencies");var settingCollection=setting.collection;var visible=true;for(var id in dependencies){if(dependencies.hasOwnProperty(id)){var target=settingCollection.get(id);if(!target){continue}var condition=dependencies[id].condition;var actual=target.get("value");var required=dependencies[id].value;if(!Tailor.Helpers.checkCondition(condition,actual,required)){visible=false;break}}}this.$el.toggle(visible)},onRender:function(){this.updateControlGroups()},onMediaButtonChange:function(e){this.media=e.currentTarget.getAttribute("data-media");this.updateControlGroups()},onDefaultButtonChange:function(){this.restoreDefaults();this.render()},onFieldChange:function(){this.setValue(this.ui.input.filter('[name^="'+this.media+'"]').val())},onSettingChange:function(){this.updateDefaultButton()},updateControlGroups:function(){var media=this.media;this.ui.controlGroups.each(function(){$(this).toggleClass("is-hidden",media!=this.id)});this.ui.mediaButton.each(function(){$(this).toggleClass("active",media==this.getAttribute("data-media"))})},updateDefaultButton:function(){this.ui.defaultButton.toggleClass("is-hidden",this.checkDefault(this.getValues()))},getSettings:function(){return this.model.settings},getSetting:function(media){media=media||this.media;var settings=this.getSettings();for(var i in settings){if(settings.hasOwnProperty(i)){if(settings[i].media==media){return settings[i]}}}return false},getDefaults:function(){var defaults={};_.each(this.getSettings(),function(setting){defaults[setting.media]=setting.get("default")});return defaults},getValues:function(){var values={};_.each(this.getSettings(),function(setting){values[setting.media]=setting.get("value")||""});return values},getDefault:function(){return this.getSetting().get("default")},getValue:function(){return this.getSetting().get("value")},setValue:function(value){this.getSetting().set("value",value)},restoreDefaults:function(){_.each(this.getSettings(),function(setting){setting.set("value",setting.get("default")); -})}});module.exports=AbstractControl},{}],13:[function(require,module,exports){var AbstractControl=require("./abstract-control"),ButtonGroupControl;ButtonGroupControl=AbstractControl.extend({ui:{input:".control__body .button",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{active:function(media,key){return key===this.values[media]?"active":""}},onFieldChange:function(e){this.ui.input.filter('[name^="'+this.media+'"]').removeClass("active");var button=e.currentTarget;button.classList.add("active");this.setValue(button.value)}});module.exports=ButtonGroupControl},{"./abstract-control":12}],14:[function(require,module,exports){var AbstractControl=require("./abstract-control"),CheckboxControl;CheckboxControl=AbstractControl.extend({events:{"change @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{checked:function(media,key){var values=this.values[media].split(",");return-1!==values.indexOf(key)?"checked":""}},onFieldChange:function(e){var values=[];_.each(this.ui.input.filter('[name^="'+this.media+'"]:checked'),function(field){if(field.checked){values.push(field.value||0)}});this.setValue(values.join(","))}});module.exports=CheckboxControl},{"./abstract-control":12}],15:[function(require,module,exports){var $=window.jQuery,AbstractControl=require("./abstract-control"),CodeControl;CodeControl=AbstractControl.extend({ui:{input:"textarea",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},addSerializedData:function(data){data.cid=this.cid;return data},onRender:function(){var control=this;var mode=control.model.get("mode");this.editors={};_.each(this.getValues(),function(value,media){var $field=control.ui.input.filter('[name^="'+media+"-"+control.cid+'"]');control.editors[media]=CodeMirror.fromTextArea($field.get(0),{mode:mode,lineNumbers:true,matchBrackets:true,continueComments:"Enter",viewportMargin:Infinity,extraKeys:{F11:function(cm){cm.setOption("fullScreen",!cm.getOption("fullScreen"))},Esc:function(cm){if(cm.getOption("fullScreen")){cm.setOption("fullScreen",false)}}}});control.editors[media].on("change",function(editor){control.setValue(editor.getValue())},this);setTimeout(function(){control.editors[media].refresh()},10)});this.updateControlGroups()},restoreDefaults:function(){_.each(this.getSettings(),function(setting,media){var value=setting.get("default")||"";setting.set("value",value)})},updateControlGroups:function(){var control=this;var media=this.media;this.ui.controlGroups.each(function(){$(this).toggleClass("is-hidden",media!=this.id)});this.ui.mediaButton.each(function(){$(this).toggleClass("active",media==this.getAttribute("data-media"))});control.editors[media].refresh()},onDestroy:function(){var control=this;_.each(this.getValues(),function(value,media){control.editors[media].off();control.editors[media].toTextArea()})}});module.exports=CodeControl},{"./abstract-control":12}],16:[function(require,module,exports){var $=window.jQuery,AbstractControl=require("./abstract-control"),ColorPickerControl;(function($){var image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==";var _before='
    ',_after='
    ',_wrap='
    ',_button='';Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var hex=parseInt(this._color,10).toString(16);if(this.error)return"";if(hex.length<6){for(var i=6-hex.length-1;i>=0;i--){hex="0"+hex}}return"#"+hex};$.widget("wp.wpColorPicker",$.wp.wpColorPicker,{_create:function(){if(!$.support.iris){return}var self=this,el=self.element;$.extend(self.options,el.data());self.close=$.proxy(self.close,self);self.initialValue=el.val();el.addClass("wp-color-picker").hide().wrap(_wrap);self.wrap=el.parent();self.toggler=$(_before).insertBefore(el).css({backgroundColor:self.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current);self.pickerContainer=$(_after).insertAfter(el);self.button=$(_button);if(self.options.defaultColor){self.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString)}else{self.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear)}el.wrap('').after(self.button);el.iris({target:self.pickerContainer,hide:self.options.hide,width:self.options.width,mode:self.options.mode,palettes:self.options.palettes,change:function(event,ui){if(self.options.rgba){self.toggler.css({"background-image":"url("+image+")"}).html("");self.toggler.find("span").css({width:"100%",height:"100%",position:"absolute",top:0,left:0,"border-top-left-radius":"3px","border-bottom-left-radius":"3px",background:ui.color.toString()})}else{self.toggler.css({backgroundColor:ui.color.toString()})}if($.isFunction(self.options.change)){self.options.change.call(this,event,ui)}}});el.val(self.initialValue);self._addListeners();if(!self.options.hide){self.toggler.click()}},_addListeners:function(){var self=this;self.wrap.on("click.wpcolorpicker",function(event){event.stopPropagation()});self.toggler.click(function(){if(self.toggler.hasClass("wp-picker-open")){self.close()}else{self.open()}});self.element.change(function(event){var me=$(this),val=me.val();if(val===""||self.element.hasClass("iris-error")){if(self.options.rgba){self.toggler.removeAttr("style");self.toggler.find("span").css("backgroundColor","")}else{self.toggler.css("backgroundColor","")}if($.isFunction(self.options.clear)){self.options.clear.call(this,event)}}});self.toggler.on("keyup",function(event){if(event.keyCode===13||event.keyCode===32){event.preventDefault();self.toggler.trigger("click").next().focus()}});self.button.click(function(event){var me=$(this);if(me.hasClass("wp-picker-clear")){self.element.val("");if(self.options.rgba){self.toggler.removeAttr("style");self.toggler.find("span").css("backgroundColor","")}else{self.toggler.css("backgroundColor","")}if($.isFunction(self.options.clear)){self.options.clear.call(this,event)}}else if(me.hasClass("wp-picker-default")){self.element.val(self.options.defaultColor).change()}})}});$.widget("a8c.iris",$.a8c.iris,{_create:function(){this._super();this.options.rgba=this.element.data("rgba")||false;if(!this.element.is(":input")){this.options.alpha=false}if(typeof this.options.rgba!=="undefined"&&this.options.rgba){var self=this,_html='
    ',aContainer=$(_html).appendTo(self.picker.find(".iris-picker-inner")),aSlider=aContainer.find(".iris-slider-offset-alpha"),controls={aContainer:aContainer,aSlider:aSlider};$.each(controls,function(k,v){self.controls[k]=v});self.controls.square.css({"margin-right":"0"});var emptyWidth=self.picker.width()-self.controls.square.width()-20,stripsMargin=emptyWidth/6,stripsWidth=emptyWidth/2-stripsMargin;$.each(["aContainer","strip"],function(k,v){self.controls[v].width(stripsWidth).css({"margin-left":stripsMargin+"px"})});self._initControls();self._change()}},_initControls:function(){this._super();if(this.options.rgba){var self=this,controls=self.controls;controls.aSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(self._color._alpha*100),slide:function(event,ui){self._color._alpha=parseFloat(ui.value/100);self._change.apply(self,arguments)}})}},_change:function(){this._super();var self=this,el=self.element;if(this.options.rgba){var controls=self.controls,alpha=parseInt(self._color._alpha*100),color=self._color.toRgb(),gradient=["rgb("+color.r+","+color.g+","+color.b+") 0%","rgba("+color.r+","+color.g+","+color.b+", 0) 100%"],defaultWidth=self.options.defaultWidth,customWidth=self.options.customWidth,target=self.picker.closest(".wp-picker-container").find(".wp-color-result");controls.aContainer.css({background:"linear-gradient(to bottom, "+gradient.join(", ")+"), url("+image+")"});if(target.hasClass("wp-picker-open")){controls.aSlider.slider("value",alpha);if(self._color._alpha<1){var style=controls.strip.attr("style").replace(/rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g,"rgb($1$3$5)");controls.strip.attr("style",style);el.width(parseInt(defaultWidth+customWidth))}else{el.width(defaultWidth)}}}var reset=el.data("reset-alpha")||false;if(reset){self.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){self._color._alpha=1;self.active="external";self._change()})}},_addInputListeners:function(input){var self=this,debounceTimeout=100,callback=function(event){var color=new Color(input.val()),val=input.val();input.removeClass("iris-error");if(color.error){if(val!==""){input.addClass("iris-error")}}else{if(color.toString()!==self._color.toString()){if(!(event.type==="keyup"&&val.match(/^[0-9a-fA-F]{3}$/))){self._setOption("color",color.toString())}}}};input.on("change",callback).on("keyup",self._debounce(callback,debounceTimeout));if(self.options.hide){input.one("focus",function(){self.show()})}}})})(jQuery);ColorPickerControl=AbstractControl.extend({addSerializedData:function(data){data.rgba=this.model.get("rgba");return data},onRender:function(){this.initWidgets();this.updateControlGroups()},onDefaultButtonChange:function(){this.restoreDefaults();this.destroyWidgets();this.render()},initWidgets:function(){var control=this;var defaults=this.getDefaults();var palettes=this.model.get("palettes");this.ui.input.each(function(){var $el=$(this);$el.wpColorPicker({palettes:palettes,defaultColor:defaults[this.name],change:function(){var color=control.ui.input.wpColorPicker("color");if("undefined"==typeof control.getValue()&&""==color){return}control.setValue($el.wpColorPicker("color"))},clear:function(){control.setValue("")}})})},destroyWidgets:function(){this.ui.input.each(function(){$(this).wpColorPicker("close")})},onBeforeDestroy:function(){this.destroyWidgets()}});module.exports=ColorPickerControl},{"./abstract-control":12}],17:[function(require,module,exports){var AbstractControl=require("./abstract-control"),EditorControl;EditorControl=AbstractControl.extend({ui:{input:"textarea",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"blur @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"restoreDefaults"},getTemplate:function(){var html=document.getElementById("tmpl-tailor-control-editor").innerHTML;return _.template(html.replace(new RegExp("tailor-editor","gi"),"<%= media %>-<%= cid %>").replace(new RegExp("tailor-value","gi"),"<%= values[ media ] %>"))},addSerializedData:function(data){data.cid=this.cid;return data},addEventListeners:function(){this.listenTo(this.getSetting().collection,"change",this.checkDependencies)},maybeRefreshEditor:function(el){if(el.contains(this.el)){_.each(this.getValues(),function(value,media){tinyMCE.execCommand("mceRemoveEditor",false,media+"-"+this.cid);tinyMCE.execCommand("mceAddEditor",false,media+"-"+this.cid)},this)}},onAttach:function(){var control=this;_.each(this.getValues(),function(value,media){var id=media+"-"+control.cid;var quickTagSettings=_.extend({},tinyMCEPreInit.qtInit["tailor-editor"],{id:id});quicktags(quickTagSettings);QTags._buttonsInit();tinyMCEPreInit.mceInit[id]=_.extend({},tinyMCEPreInit.mceInit["tailor-editor"],{id:id,resize:"vertical",height:350,setup:function(ed){ed.on("change",function(){ed.save();control.setValue(ed.getContent())})}});switchEditors.go(id,"tmce");tinymce.execCommand("mceAddEditor",true,id)},this)},restoreDefaults:function(){_.each(this.getSettings(),function(setting){var value=setting.get("default")||"";setting.set("value",value);var editor=tinyMCE.get(setting.media+"-"+this.cid);editor.setContent(value)},this)},onDestroy:function(){_.each(this.getValues(),function(value,media){tinyMCE.execCommand("mceRemoveEditor",true,media+"-"+this.cid)},this)}});module.exports=EditorControl},{"./abstract-control":12}],18:[function(require,module,exports){var AbstractControl=require("./abstract-control"),GalleryControl;GalleryControl=AbstractControl.extend({ui:{select:".button--select",change:".button--change",remove:".button--remove",thumbnails:".thumbnails",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.select":"selectImages","click @ui.change":"selectImages","click @ui.remove":"removeImages","click @ui.thumbnails":"selectImages","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},addSerializedData:function(data){data.ids={};_.each(data.values,function(value,media){data.ids[media]=this.getIds(value)},this);return data},selectImages:function(){_.each(this.getValues(),function(value,media){if(media==this.media){var control=this;var ids=control.getIds(value);var selection=this.getSelection(ids);var frame=wp.media({frame:"post",state:ids.length?"gallery-edit":"gallery-library",editing:true,multiple:true,selection:selection});var library;frame.on("open",function(){var mediaFrame=frame.views.get(".media-frame-menu")[0];mediaFrame.$el.children().slice(0,2).hide();library=JSON.stringify(selection.toJSON())}).on("update",function(collection){var value=collection.pluck("id").join(",");control.setValue(value);if(!_.isEqual(library,JSON.stringify(collection.toJSON()))){var setting=control.getSetting(media);setting.trigger("change",setting,value)}}).on("close",function(){frame.dispose()});frame.open()}},this)},getIds:function(value){if(_.isEmpty(value)){return false}return value.split(",")},removeImages:function(){this.setValue("")},onSettingChange:function(){this.render()},onRender:function(){var control=this;_.each(this.getValues(),function(value,media){var selection=this.getSelection(control.getIds(value));selection.more().done(function(){selection.props.set({query:false});selection.unmirror();selection.props.unset("orderby");control.updateThumbnails(selection,media)})},this);this.updateControlGroups()},updateThumbnails:function(selection,media){var html="";var urls=selection.map(function(attachment){var sizes=attachment.get("sizes");var url;if(sizes.hasOwnProperty("medium")){url=sizes.medium.url}else if(sizes.hasOwnProperty("thumbnail")){url=sizes.thumbnail.url}else if(sizes.hasOwnProperty("full")){url=sizes.full.url}else{url=""}return url});if(urls.length){_.each(urls,function(url){html+='
  • '})}this.ui.controlGroups.filter('[id^="'+media+'"]').find(".thumbnails").removeClass("is-loading").html(html)},getSelection:function(ids){var attachments=wp.media.query({orderby:"post__in",order:"ASC",type:"image",post__in:ids});return new wp.media.model.Selection(attachments.models,{props:attachments.props.toJSON(),multiple:true})}});module.exports=GalleryControl},{"./abstract-control":12}],19:[function(require,module,exports){var $=Backbone.$,AbstractControl=require("./abstract-control"),IconControl;IconControl=AbstractControl.extend({ui:{select:".button--select",change:".button--change",remove:".button--remove",icon:"i",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.select":"openDialog","click @ui.change":"openDialog","click @ui.remove":"removeIcon","click @ui.icon":"openDialog","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},openDialog:function(){var control=this;var options={title:"Select Icon",button:window._l10n.select,content:function(){var kits=window._kits||{};var value=control.getValue();if(_.keys(kits).length){return _.template(document.getElementById("tmpl-tailor-control-icon-select").innerHTML)({kits:kits,value:value})}return document.getElementById("tmpl-tailor-control-icon-empty").innerHTML},onOpen:function(){var $el=this.$el;var $li=$el.find("li");var $kits=$el.find(".icon-kit");this.$el.find(".search--icon").on("input",function(e){var term=this.value.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");term=term.replace(/ /g,")(?=.*");var match=new RegExp("^(?=.*"+term+").+","i");$li.each(function(){this.classList.toggle("is-hidden",!match.test(this.getAttribute("title")))})});this.$el.find(".select--icon").on("change",function(e){var kit=this.value;$kits.removeClass("is-hidden").filter(function(){return this.id!=kit}).addClass("is-hidden")})},onValidate:function(){return $("input[name=icon]:checked").val()},onSave:function(){control.setValue($("input[name=icon]:checked").val())},onClose:function(){this.$el.find(".search--icon").off("input")}};app.channel.trigger("dialog:open",options)},onSettingChange:function(){this.render()},removeIcon:function(){this.setValue("")}});module.exports=IconControl},{"./abstract-control":12}],20:[function(require,module,exports){var AbstractControl=require("./abstract-control"),ImageControl;ImageControl=AbstractControl.extend({ui:{select:".button--select",change:".button--change",remove:".button--remove",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *",thumbnail:".thumbnail"},events:{"click @ui.select":"openFrame","click @ui.change":"openFrame","click @ui.remove":"removeImage","click @ui.thumbnail":"openFrame","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},initialize:function(options){this.frame=wp.media({states:[new wp.media.controller.Library({title:"Select Image",library:wp.media.query({type:["image"]}),multiple:false,date:false})]});this.addEventListeners();this.checkDependencies()},addEventListeners:function(){_.each(this.getSettings(),function(setting){this.listenTo(setting,"change",this.onSettingChange)},this);this.listenTo(this.getSetting().collection,"change",this.checkDependencies);this.frame.on("select",this.selectImage.bind(this))},openFrame:function(){this.frame.open()},selectImage:function(){var selection=this.frame.state().get("selection");var attachment=selection.first();var sizes=attachment.get("sizes");this.setValue(attachment.get("id"))},updateThumbnail:function(sizes,media){var url;if(sizes.hasOwnProperty("medium")){url=sizes.medium.url}else if(sizes.hasOwnProperty("thumbnail")){url=sizes.thumbnail.url}else if(sizes.hasOwnProperty("full")){url=sizes.full.url}else{return}this.ui.controlGroups.filter('[id^="'+media+'"]').find(".thumbnails").removeClass("is-loading").html('
  • ')},removeImage:function(){this.setValue("")},onSettingChange:function(){this.render()},onRender:function(){_.each(this.getValues(),function(value,media){if(value){var attachment=wp.media.attachment(value);var sizes=attachment.get("sizes");if(sizes){this.updateThumbnail(sizes,media)}else{var control=this;attachment.fetch({success:function(){sizes=attachment.get("sizes");control.updateThumbnail(sizes,media)}})}}},this);this.updateControlGroups()},onDestroy:function(){this.frame.off().dispose()}});module.exports=ImageControl},{"./abstract-control":12}],21:[function(require,module,exports){var AbstractControl=require("./abstract-control"),InputGroup;InputGroup=AbstractControl.extend({addSerializedData:function(data){data.choices=this.model.get("choices");data.values={};_.each(this.getValues(),function(value,media){data.values[media]={};var values=[];if(_.isString(value)){if(-1!=value.indexOf(",")){values=value.split(",")}else{values=value.split("-")}}var i=0;for(var choice in data.choices){if(data.choices.hasOwnProperty(choice)){data.values[media][choice]=values[i];i++}}});return data},onFieldChange:function(e){var fields=this.ui.input.filter('[name^="'+this.media+'"]').serializeArray();var values=_.map(fields,function(field){return field.value});this.setValue(values.join(","))}});module.exports=InputGroup},{"./abstract-control":12}],22:[function(require,module,exports){var $=Backbone.$,AbstractControl=require("./abstract-control"),LinkControl;LinkControl=AbstractControl.extend({ui:{input:"input",select:".button--select",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"blur @ui.input":"onFieldChange","click @ui.select":"openDialog","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},addSerializedData:function(data){data.placeholder=this.model.get("placeholder");return data},search:function(term){var control=this;var $searchResults=this.$el.find(".search-results");if($searchResults.length){control.$el.addClass("is-searching");var options={data:{s:term,nonce:window._nonces.query},success:function(response){$searchResults.html(response)},complete:function(){control.$el.removeClass("is-searching")}};window.ajax.send("tailor_get_links",options)}},openDialog:function(){var control=this;var options={title:"Select content",button:window._l10n.select,content:function(){return'
    '+''+''+'
    '+"
    "},onOpen:function(){var dialog=this;var previousTerm="";var minimumCharacters=3;var timeout;this.$el.find(".search--content").on("input",function(e){clearTimeout(timeout);var term=this.value;if(term.length>=minimumCharacters&&previousTerm!=$.trim(term)){timeout=setTimeout($.proxy(control.search,dialog,term),500)}})},onValidate:function(){return $("input[name=url]:checked").val()},onSave:function(){var url=$("input[name=url]:checked").val();control.setValue(url)},onClose:function(){this.$el.find(".search--content").off("input")}};app.channel.trigger("dialog:open",options)},onSettingChange:function(){this.render()}});module.exports=LinkControl},{"./abstract-control":12}],23:[function(require,module,exports){var EmptyListView=Marionette.ItemView.extend({template:"#tmpl-tailor-control-list-empty"});module.exports=EmptyListView},{}],24:[function(require,module,exports){var ListItemControl=Marionette.CompositeView.extend({tagName:"li",className:"list-item",ui:{title:".list-item__title",content:".list-item__content",delete:".js-delete-list-item",close:".js-close-list-item"},triggers:{"click @ui.title":"toggle","click @ui.close":"toggle","click @ui.delete":"delete"},events:{keypress:"onKeyPress"},getChildView:function(child){return Tailor.lookup(child.get("type"),false,"Controls")},childViewContainer:"#controls",template:"#tmpl-tailor-control-list-item",initialize:function(options){this.settings=options.settings;this._open=false;this.model.startTracking();this.addEventListeners()},addEventListeners:function(){this.listenTo(this.settings,"change",this.onChangeSettings);this.listenTo(app.channel,"modal:apply",this.onApplyModal);this.listenTo(app.channel,"modal:close",this.onCloseModal)},updateTitle:function(from,to){this.ui.title.find(":contains("+from+")").html(to)},onKeyPress:function(e){if(13===e.which){this.triggerMethod("toggle")}},onToggle:function(){if(this._open){this.slideUp()}else{this.slideDown()}},slideUp:function(){var control=this;control._open=false;control.ui.content.slideUp(150,function(){control.el.classList.remove("is-open")})},slideDown:function(){var control=this;control._open=true;control.ui.content.slideDown(150,function(){control.el.classList.add("is-open")})},onDelete:function(){var control=this;control.$el.slideUp(250,function(){control.triggerMethod("remove")})},onChangeSettings:function(setting){var atts=_.clone(this.model.get("atts"));var settingId=setting.get("id");var settingValue=setting.get("value");if("title"==settingId){this.updateTitle(atts.title,settingValue)}atts[settingId]=settingValue;this.model.set("atts",atts)},onApplyModal:function(){this.model.stopTracking()},onCloseModal:function(){this.model.resetAttributes()}});module.exports=ListItemControl},{}],25:[function(require,module,exports){var ListControl=Marionette.CompositeView.extend({childView:require("./list-item"),childViewContainer:"#list-items",emptyView:require("./list-empty"),className:function(){return"control control--"+this.model.get("type")},ui:{button:".js-add"},events:{"click @ui.button":"addItem"},collectionEvents:{add:"updateContent",remove:"updateContent",change:"updateContent"},childEvents:{remove:"deleteItem",toggle:"onToggleItem"},template:"#tmpl-tailor-control-list",serializeData:function(){var data=Backbone.Marionette.ItemView.prototype.serializeData.apply(this,arguments);data.childLabel=this.child.get("label").toLowerCase();return data},childViewOptions:function(model,index){var controlCollection=app.channel.request("sidebar:controls",model);var settingCollection=app.channel.request("sidebar:settings",model);var options={model:model,collection:controlCollection,settings:settingCollection};return options},initialize:function(options){this.element=options.element;this._added=[];this._deleted=[];var listItemDefinition=app.channel.request("sidebar:library",this.element.get("tag"));this.child=app.channel.request("sidebar:library",listItemDefinition.get("child"));this.addEventListeners()},addEventListeners:function(){this.listenTo(app.channel,"modal:apply",this.onApplyModal);this.listenTo(app.channel,"modal:close",this.onCloseModal)},filter:function(child,index,collection){return child.get("parent")==this.element.get("id")},onRender:function(){var listControl=this;this.sortable=Sortable.create(this.$childViewContainer.get(0),{draggable:".list-item",handle:".list-item__title",animation:250,onEnd:function(e){app.channel.trigger("list:change:order",listControl.el);listControl.updateOrder()}})},isEmpty:function(){return this.collection.getChildren(this.element).length==0},onToggleItem:function(child){this.children.each(function(childView){if(childView!==child){childView.slideUp()}},this)},onAddChild:function(child){this.children.each(function(childView){if(childView!==child){childView.slideUp()}},this)},addItem:function(){var numberChildren=this.collection.getChildren(this.element).length;var item=_.first(this.collection.create([{tag:this.child.get("tag"),parent:this.element.get("id"),order:numberChildren,atts:{title:this.child.get("label")}}],{}));this._added.push(item)},deleteItem:function(view){for(var i=0;i *"},events:{"input @ui.range":"onFieldChange","blur @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{inputAttrs:function(){var atts="";_.each(this.attrs,function(value,attr){atts+=attr+'="'+value+'"'});return atts}},addSerializedData:function(data){data.attrs=this.model.get("input_attrs");return data},onFieldChange:function(e){var value=e.target.value;this.ui.input.filter('[name^="'+this.media+'"]').val(value);this.ui.range.filter('[name^="'+this.media+'"]').val(value);this.setValue(value)}});module.exports=RangeControl},{"./abstract-control":12}],28:[function(require,module,exports){var AbstractControl=require("./abstract-control"),SelectMultiControl;SelectMultiControl=AbstractControl.extend({ui:{input:"select",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"change @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{selected:function(media,key){var values=this.values[media].split(",");return-1!==values.indexOf(key)?"selected":""}},onRender:function(){_.each(this.getValues(),function(value,media){var $field=this.ui.input.filter('[name^="'+media+'"]');$field.select2()},this);this.updateControlGroups()},onFieldChange:function(){var $field=this.ui.input.filter('[name^="'+this.media+'"]');var field=$field.get(0);var values=[];for(var i=0;i *"},events:{"change @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{selected:function(media,key){return key===this.values[media]?"selected":""}}});module.exports=SelectControl},{"./abstract-control":12}],30:[function(require,module,exports){var $=window.jQuery,AbstractControl=require("./abstract-control"),StyleControl;StyleControl=AbstractControl.extend({linked:true,ui:{input:"input",mediaButton:".js-setting-group .button",defaultButton:".js-default",linkButton:".js-link",controlGroups:".control__body > *"},events:{"input @ui.input":"updateLinkedFields","blur @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange","click @ui.linkButton":"onLinkButtonChange"},addSerializedData:function(data){data.choices=this.model.get("choices");data.values={};_.each(this.getValues(),function(value,media){data.values[media]={};var values=[];if(_.isString(value)){if(-1!=value.indexOf(",")){values=value.split(",")}else{values=value.split("-")}}var i=0;for(var choice in data.choices){if(data.choices.hasOwnProperty(choice)){data.values[media][choice]=values[i];i++}}});return data},onRender:function(){ -this.updateControlGroups();this.updateLinkButton()},onLinkButtonChange:function(){this.linked=!this.linked;this.updateLinkButton()},onFieldChange:function(e){var fields=this.ui.input.filter('[name^="'+this.media+'"]').serializeArray();var values=_.map(fields,function(field){return field.value});this.setValue(values.join(","))},updateLinkButton:function(){this.ui.linkButton.toggleClass("is-active",this.linked)},updateLinkedFields:function(e){if(this.linked){this.ui.input.filter('[name^="'+this.media+'"]').filter(function(i,el){return el!=e.currentTarget}).val(e.currentTarget.value)}}});module.exports=StyleControl},{"./abstract-control":12}],31:[function(require,module,exports){var AbstractControl=require("./abstract-control"),SwitchControl;SwitchControl=AbstractControl.extend({events:{"change @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{checked:function(media){return 1==parseInt(this.values[media],10)?"checked":""}},onFieldChange:function(){var $field=this.ui.input.filter('[name^="'+this.media+'"]');this.setValue($field.get(0).checked?"1":"0")}});module.exports=SwitchControl},{"./abstract-control":12}],32:[function(require,module,exports){var AbstractControl=require("./abstract-control"),TextControl;TextControl=AbstractControl.extend({templateHelpers:{inputAttrs:function(){var atts="";_.each(this.attrs,function(value,attr){atts+=attr+'="'+value+'"'});return atts}},addSerializedData:function(data){data.attrs=this.model.get("input_attrs");return data}});module.exports=TextControl},{"./abstract-control":12}],33:[function(require,module,exports){var AbstractControl=require("./abstract-control"),TextareaControl;TextareaControl=AbstractControl.extend({ui:{input:"textarea",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"}});module.exports=TextareaControl},{"./abstract-control":12}],34:[function(require,module,exports){var $=Backbone.$,AbstractControl=require("./abstract-control"),VideoControl;VideoControl=AbstractControl.extend({ui:{select:".button--select",enterUrl:".button--enter",change:".button--change",remove:".button--remove",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.select":"openFrame","click @ui.enterUrl":"openDialog","click @ui.change":"openFrame","click @ui.remove":"removeVideo","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},initialize:function(options){this.frame=wp.media({states:[new wp.media.controller.Library({title:"Select Video",library:wp.media.query({type:["video"]}),multiple:false,date:false})]});this.addEventListeners();this.checkDependencies()},addEventListeners:function(){_.each(this.getSettings(),function(setting){this.listenTo(setting,"change",this.onSettingChange)},this);this.listenTo(this.getSetting().collection,"change",this.checkDependencies);this.frame.on("select",this.selectVideo.bind(this))},openFrame:function(){this.frame.open()},selectVideo:function(){var selection=this.frame.state().get("selection");var attachment=selection.first();this.setValue(attachment.get("id"))},openDialog:function(){var control=this;var options={title:"Enter URL",button:window._l10n.select,content:function(){return'
    '+''+"
    "},onValidate:function(){var url=$(".search--content").val();return url&&/^(ftp|http|https):\/\/[^ "]+$/.test(url)},onSave:function(){control.setValue($(".search--content").val())},onClose:function(){this.$el.find(".search--content").off("input")}};app.channel.trigger("dialog:open",options)},onSettingChange:function(){this.render()},removeVideo:function(){this.setValue("")},onRender:function(){var control=this;_.each(this.getValues(),function(value,media){if(value){var attachment=wp.media.attachment(value);if(!attachment.get("url")){attachment.fetch({success:function(){control.updatePreview(attachment,media)}})}else{control.updatePreview(attachment,media)}}},this);this.updateControlGroups()},updatePreview:function(attachment,media){var url=attachment.get("url");var mime=attachment.get("mime");this.ui.controlGroups.filter('[id^="'+media+'"]').find(".video-preview").removeClass("is-loading").html('')},onDestroy:function(){this.frame.dispose()}});module.exports=VideoControl},{"./abstract-control":12}],35:[function(require,module,exports){var $=window.jQuery,AbstractControl=require("./abstract-control"),WidgetFormControl;WidgetFormControl=AbstractControl.extend({ui:{},events:{"blur *":"onFieldChange","change *":"onFieldChange"},getTemplateId:function(){return"tmpl-tailor-widget-form-"+this.model.get("widget_id_base")},getTemplate:function(){var el=document.getElementById(this.getTemplateId());var template="";if(el){template=_.template(el.innerHTML)}return template},onRender:function(){var idBase=this.model.get("widget_id_base");var $el=this.$el;this.$el.find("label").addClass("control__title").each(function(){var $label=$(this);$label.html(this.innerHTML.replace(":",""))});_.each(this.getValues(),function(value,media){if(!_.isEmpty(value)){var values=JSON.parse(value);_.each(values,function(value,name){var $field=$el.find('[name="widget-'+idBase+"[__i__]["+name+']"]');if($field.length){if("checkbox"==$field[0].type||"radio"==$field[0].type){$field.attr("checked","true")}else{$field.val(value)}}})}},this)},onFieldChange:function(e){var fields=this.$el.find("input, select, radio, textarea").serializeArray();var values={};$.each(fields,function(){var matches=this.name.match(/\[(.*?)\]/g);if(matches&&2==matches.length){var name=matches[1].substring(1,matches[1].length-1);if("undefined"!=typeof values[name]){if(!values[name].push){values[name]=[values[name]]}values[name].push(this.value||"")}else{values[name]=this.value||""}}});this.setValue(JSON.stringify(values));e.preventDefault();e.stopImmediatePropagation()},onSettingChange:function(){}});module.exports=WidgetFormControl},{"./abstract-control":12}],36:[function(require,module,exports){var DefaultPanel=Marionette.CompositeView.extend({ui:{backButton:".back-button"},triggers:{"click @ui.backButton":"back:home"},behaviors:{Panel:{}},emptyView:Tailor.Panels.Empty,emptyViewOptions:function(){return{type:this.model.get("type")}},childViewContainer:"#items",getChildView:function(){return Tailor.lookup(this.model.get("type"),false,"Items")},filter:function(child,index,collection){switch(this.model.get("type")){case"library":return!_.contains(["tailor_row"],child.get("tag"))&&"child"!=child.get("type");break;case"default":return child.get("panel")===this.model.get("id");break;default:return true;break}},getTemplate:function(){var type=this.model.get("type")||"default";return"#tmpl-tailor-panel-"+type},serializeData:function(){var data=Marionette.ItemView.prototype.serializeData.apply(this,arguments);data.items=this.collection;return data},onShow:function(){this.ui.backButton.get(0).focus()}});module.exports=DefaultPanel},{}],37:[function(require,module,exports){var EmptyPanelView=Marionette.ItemView.extend({className:"empty",initialize:function(options){this.type=options.type},getTemplate:function(){var type=this.type||"default";return"#tmpl-tailor-panel-"+type+"-empty"}});module.exports=EmptyPanelView},{}],38:[function(require,module,exports){var DefaultSection=Marionette.CompositeView.extend({ui:{backButton:".back-button"},triggers:{"click @ui.backButton":"back:panel"},behaviors:{Panel:{}},emptyView:require("./section-empty"),childViewContainer:"#controls",initialize:function(options){this.panel=options.panel},getChildView:function(child){return Tailor.lookup(child.get("type"),false,"Controls")},filter:function(child,index,collection){if("default"===this.model.get("type")){return child.get("section")===this.model.get("id")}return true},getTemplate:function(){return"#tmpl-tailor-section-"+this.model.get("type")},serializeData:function(){var data=Marionette.ItemView.prototype.serializeData.apply(this,arguments);data.panel=this.panel.get("title");return data},onShow:function(){this.ui.backButton.get(0).focus()}});module.exports=DefaultSection},{"./section-empty":39}],39:[function(require,module,exports){var EmptySectionView=Marionette.ItemView.extend({className:"empty",getTemplate:function(){var type=this.model.get("type")||"default";return"#tmpl-tailor-section-"+type+"-empty"}});module.exports=EmptySectionView},{}],40:[function(require,module,exports){var ControlCollection=Backbone.Collection.extend({model:require("../models/control"),initialize:function(models,options){if(options&&options.settings){this.settings=options.settings}this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"reset",this.onReset)},onReset:function(){var mediaQueries=[];for(var mediaQueryId in _media_queries){if(_media_queries.hasOwnProperty(mediaQueryId)&&""!=_media_queries[mediaQueryId].max){mediaQueries.push(mediaQueryId)}}this.each(function(model){var settingId=model.get("setting");model.settings=this.settings.filter(function(setting){var id=setting.get("id");if(id==settingId){setting.media="desktop";return true}else{var index=_.indexOf(mediaQueries,id.replace(settingId+"_",""));if(-1!==index){setting.media=mediaQueries[index];return true}}return false})},this)}});module.exports=ControlCollection},{"../models/control":48}],41:[function(require,module,exports){var SearchableCollection=require("./searchable"),LibraryCollection;LibraryCollection=SearchableCollection.extend({model:function(attrs,options){var Model=Tailor.lookup(attrs.tag,attrs.type,"Models");return new Model(attrs,options)},comparator:"label",getHaystack:function(model){return[model.get("label"),model.get("type"),model.get("description"),model.get("badge"),model.get("tag")].join(" ")}});module.exports=LibraryCollection},{"./searchable":43}],42:[function(require,module,exports){var PanelCollection=Backbone.Collection.extend({model:require("../models/panel")});module.exports=PanelCollection},{"../models/panel":52}],43:[function(require,module,exports){var $=Backbone.$,SearchableCollection;SearchableCollection=Backbone.Collection.extend({doSearch:function(value){if(this.terms===value){return}this.terms=value;if(this.terms.length>0){this.search(this.terms)}if(this.terms===""){this.each(function(item){item.set("match",true)})}},search:function(term){var match,haystack;term=term.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");term=term.replace(/ /g,")(?=.*");match=new RegExp("^(?=.*"+term+").+","i");this.each(function(item){haystack=this.getHaystack(item);item.set("match",match.test(haystack))},this)}});module.exports=SearchableCollection},{}],44:[function(require,module,exports){var SectionCollection=Backbone.Collection.extend({model:require("../models/section")});module.exports=SectionCollection},{"../models/section":53}],45:[function(require,module,exports){var SettingCollection=Backbone.Collection.extend({model:require("../models/setting"),initialize:function(models,options){if(options&&options.element){this.element=options.element}this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"reset",this.load)},load:function(){var atts=this.element.get("atts");this.each(function(model){model.set("value",atts[model.get("id")])},this)}});module.exports=SettingCollection},{"../models/setting":54}],46:[function(require,module,exports){var SnapshotCollection=Backbone.Collection.extend({maxSize:50,active:null,comparator:function(model){return-model.get("timestamp")},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"add",this.checkLength);this.listenToOnce(app.channel,"canvas:initialize",function(){this.elements=app.channel.request("canvas:elements");this.save(window._l10n.initialized)})},save:function(label){if(this.active){var activePosition=this.indexOf(this.active);if(activePosition>0){this.remove(this.slice(0,activePosition))}}var entry=this.add({label:label||"",elements:this.elements?this.elements.toJSON():[],time:this.getTime(),timestamp:_.now()});this.setActive(entry)},getTime:function(){var date=new Date;var hours=date.getHours();var separator=":";var suffix;if(hours>12){hours-=12;suffix=" PM"}else{suffix=" AM"}return hours+separator+("0"+date.getMinutes()).slice(-2)+separator+("0"+date.getSeconds()).slice(-2)+suffix},restore:function(timestamp){var entry=this.findWhere({timestamp:timestamp});if(!entry||entry===this.getActive()){return}this.setActive(entry);var elements=entry.get("elements");app.channel.trigger("elements:reset",elements)},undo:function(){if(!this.length){return}var entry=this.at(this.indexOf(this.getActive())+1);if(entry){this.restore(entry.get("timestamp"))}},redo:function(){if(!this.length){return}var entry=this.at(this.indexOf(this.getActive())-1);if(entry){this.restore(entry.get("timestamp"))}},checkLength:function(){if(this.length>this.maxSize){this.pop()}},setActive:function(model){this.active=model;this.trigger("change:active",model)},getActive:function(){return this.active}});module.exports=SnapshotCollection},{}],47:[function(require,module,exports){var SearchableCollection=require("./searchable"),TemplateCollection;TemplateCollection=SearchableCollection.extend({model:require("../models/template"),comparator:"name",getHaystack:function(model){return[model.get("id"),model.get("label")].join(" ")}});module.exports=TemplateCollection},{"../models/template":55,"./searchable":43}],48:[function(require,module,exports){var ControlModel=Backbone.Model.extend({defaults:{id:"",label:"",description:"",type:"",choices:{},priority:0,setting:"",section:""}});module.exports=ControlModel},{}],49:[function(require,module,exports){var ContainerModel=Backbone.Model.extend({defaults:function(){return{label:"",description:"",tag:"",icon:"",sections:[],controls:[],type:"default",child:"",collection:"library"}},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:add:top",this.insertBefore);this.listenTo(this,"element:add:bottom",this.insertAfter);this.listenTo(this,"element:add:left",this.columnBefore);this.listenTo(this,"element:add:right",this.columnAfter)},insertBefore:function(view){this.insertAtIndex(view.model,view.model.get("order"))},insertAfter:function(view){this.insertAtIndex(view.model,view.model.get("order")+1)},insertAtIndex:function(model,index){var tag="tailor_content";var children=model.collection.create([{tag:tag,atts:{}},{tag:tag,atts:{}}],{silent:true});model.collection.createContainer(this,model.get("parent"),index,children)},columnBefore:function(view){var parentId=view.model.get("parent");var tag="tailor_content";var children;if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,view.model.get("order")-1);children=view.model.collection.create([{tag:tag,atts:{}},{tag:tag,atts:{}}],{silent:true});view.model.collection.createContainer(this,column.get("id"),0,children)}else{var columns=view.model.collection.createRow(parentId,view.model.get("order"));view.model.collection.insertChild(view.model,_.last(columns));children=view.model.collection.create([{tag:tag,atts:{}},{tag:tag,atts:{}}],{silent:true});view.model.collection.createContainer(this,_.first(columns).get("id"),0,children)}},columnAfter:function(view){var parentId=view.model.get("parent");var tag="tailor_content";var children;if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,view.model.get("order"));children=view.model.collection.create([{tag:tag,atts:{}},{tag:tag,atts:{}}],{silent:true});view.model.collection.createContainer(this,column.get("id"),0,children)}else{var columns=view.model.collection.createRow(parentId,view.model.get("order"));view.model.collection.insertChild(view.model,_.first(columns));children=view.model.collection.create([{tag:tag,atts:{}},{tag:tag,atts:{}}],{silent:true});view.model.collection.createContainer(this,_.last(columns).get("id"),0,children)}}});module.exports=ContainerModel},{}],50:[function(require,module,exports){var WrapperModel=Backbone.Model.extend({defaults:function(){return{label:"",description:"",tag:"",icon:"",sections:[],controls:[],type:"default",child:"",collection:"library"}},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:add:top",this.insertBefore);this.listenTo(this,"element:add:bottom",this.insertAfter);this.listenTo(this,"element:add:left",this.columnBefore);this.listenTo(this,"element:add:right",this.columnAfter);this.listenTo(this,"element:add:center",this.createChild)},insertBefore:function(view){this.insertAtIndex(view.model,view.model.get("order")-1)},insertAfter:function(view){this.insertAtIndex(view.model,view.model.get("order"))},insertAtIndex:function(model,index){model.collection.createWrapper(this.get("tag"),model.get("parent"),index)},columnBefore:function(view){var parentId=view.model.get("parent");var index=view.model.get("order")-1;var tag="tailor_content";if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,index);view.model.collection.createWrapper(this.get("tag"),column.get("id"),0)}else{var columns=view.model.collection.createRow(parentId,index);view.model.collection.insertChild(view.model,_.last(columns));view.model.collection.createWrapper(this.get("tag"),_.first(columns).get("id"),0)}},columnAfter:function(view){var parentId=view.model.get("parent");var index=view.model.get("order");var tag="tailor_content";if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,index);view.model.collection.createWrapper(this.get("tag"),column.get("id"),0)}else{var columns=view.model.collection.createRow(parentId,index);view.model.collection.insertChild(view.model,_.first(columns));view.model.collection.createWrapper(this.get("tag"),_.last(columns).get("id"),0)}},createChild:function(view){var parentId=view.model.get("id");var childTag=view.model.get("child");var numberChildren=view.model.collection.where({parent:parentId,tag:childTag}).length;var wrapper=view.model.collection.createWrapper(childTag,parentId,numberChildren,false);view.model.collection.createWrapper(this.get("tag"),wrapper.get("id"),0)}});module.exports=WrapperModel},{}],51:[function(require,module,exports){var ElementModel=Backbone.Model.extend({defaults:function(){return{label:"",description:"",tag:"",icon:"",sections:[],controls:[],type:"default",child:"",collection:"library"}},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:add:top",this.insertBefore);this.listenTo(this,"element:add:bottom",this.insertAfter);this.listenTo(this,"element:add:left",this.columnBefore);this.listenTo(this,"element:add:right",this.columnAfter);this.listenTo(this,"element:add:center",this.createChild)},insertBefore:function(view){this.insertAtIndex(view.model,view.model.get("order")-1)},insertAfter:function(view){this.insertAtIndex(view.model,view.model.get("order"))},insertAtIndex:function(model,index){model.collection.create([{tag:this.get("tag"),label:this.get("label"),parent:model.get("parent"),type:this.get("type"),order:index}],{})},columnBefore:function(view){var parentId=view.model.get("parent");if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,view.model.get("order")-1);view.model.collection.create([{tag:this.get("tag"),label:this.get("label"),parent:column.get("id"),type:this.get("type"),order:0}],{at:0})}else{var columns=view.model.collection.createRow(parentId,view.model.get("order"));view.model.collection.create([{tag:this.get("tag"),label:this.get("label"),parent:_.first(columns).get("id"),type:this.get("type"),order:0}],{at:0});view.model.collection.insertChild(view.model,_.last(columns))}},columnAfter:function(view){var parentId=view.model.get("parent");if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,view.model.get("order"));view.model.collection.create([{tag:this.get("tag"),label:this.get("label"),parent:column.get("id"),type:this.get("type"),order:0}],{at:0})}else{var columns=view.model.collection.createRow(parentId,view.model.get("order"));view.model.collection.create([{tag:this.get("tag"),label:this.get("label"),parent:_.last(columns).get("id"),type:this.get("type"),order:0}],{at:0});view.model.collection.insertChild(view.model,_.first(columns))}},createChild:function(view){var parentId=view.model.get("id");var childTag=view.model.get("child");var numberChildren=view.model.collection.where({parent:parentId,tag:childTag}).length;var wrapper=view.model.collection.createWrapper(childTag,parentId,numberChildren,false);var child=view.model.collection.create([{tag:this.get("tag"),label:this.get("label"),parent:wrapper.get("id"),type:this.get("type"),order:0}],{at:0})}});module.exports=ElementModel},{}],52:[function(require,module,exports){var PanelModel=Backbone.Model.extend({defaults:{id:"",title:"",description:"",collection:"",priority:0}});module.exports=PanelModel},{}],53:[function(require,module,exports){var SectionModel=Backbone.Model.extend({defaults:{id:"",title:"",description:"",priority:0,panel:""}});module.exports=SectionModel},{}],54:[function(require,module,exports){var SettingModel=Backbone.Model.extend({defaults:{id:"",type:""}});module.exports=SettingModel},{}],55:[function(require,module,exports){var TemplateModel=Backbone.Model.extend({defaults:function(){return{id:this.cid,label:"",collection:"template"}},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:add:top",this.insertBefore);this.listenTo(this,"element:add:bottom",this.insertAfter);this.listenTo(this,"element:add:left",this.columnBefore);this.listenTo(this,"element:add:right",this.columnAfter);this.listenTo(this,"element:add:center",this.createChild)},createChild:function(view){var parentId=view.model.get("id");var childTag=view.model.get("child");var numberChildren=view.model.collection.where({parent:parentId,tag:childTag}).length;var wrapper=view.model.collection.createWrapper(childTag,parentId,numberChildren,false);app.channel.trigger("template:load",this,wrapper.get("id"),0)},columnBefore:function(view){var parentId=view.model.get("parent");if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,view.model.get("order")-1);app.channel.trigger("template:load",this,column.get("id"),0)}else{var columns=view.model.collection.createRow(parentId,view.model.get("order"));app.channel.trigger("template:load",this,_.first(columns).get("id"),0);view.model.collection.insertChild(view.model,_.last(columns))}},columnAfter:function(view){var parentId=view.model.get("parent");if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,view.model.get("order"));app.channel.trigger("template:load",this,column.get("id"),0)}else{var columns=view.model.collection.createRow(parentId,view.model.get("order"));app.channel.trigger("template:load",this,_.last(columns).get("id"),0);view.model.collection.insertChild(view.model,_.first(columns))}},insertBefore:function(view){app.channel.trigger("template:load",this,view.model.get("parent"),view.model.get("order")-1)},insertAfter:function(view){app.channel.trigger("template:load",this,view.model.get("parent"),view.model.get("order"))}});module.exports=TemplateModel},{}],56:[function(require,module,exports){var $=window.jQuery,DevicePreviewModule;DevicePreviewModule=Marionette.Module.extend({device:"desktop",onBeforeStart:function(){var module=this;var api={getDevice:function(){return module.device}};app.channel.reply("sidebar:device",api.getDevice)},onStart:function(){var module=this;this.$buttons=$(".tailor-sidebar .devices button");this.preview=document.querySelector(".tailor-preview");this.viewport=this.preview.querySelector(".tailor-preview__viewport");this.mediaQueries=window._media_queries;this.setActive(this.$buttons.get(0));this.addEventListeners();app.channel.trigger("module:devicePreview:ready",this)},addEventListeners:function(){this.$buttons.on("click",this.onDevicePreview.bind(this))},onDevicePreview:function(e){var button=e.target;var previous=this.$buttons.filter("[data-device='"+this.device+"']").get(0);this.setInactive(previous);this.setActive(button);this.device=button.getAttribute("data-device");this.preview.className="tailor-preview "+this.device+"-screens";if(this.mediaQueries.hasOwnProperty(this.device)&&this.mediaQueries[this.device].max){this.viewport.style.maxWidth=this.mediaQueries[this.device].max}else{this.viewport.style.maxWidth=""}},setActive:function(button){button.classList.add("is-active");button.setAttribute("aria-pressed","true")},setInactive:function(button){button.classList.remove("is-active");button.setAttribute("aria-pressed","false")}});module.exports=DevicePreviewModule},{}],57:[function(require,module,exports){var DialogRegion=Backbone.Marionette.Region.extend({initialize:function(){this.$overlay=jQuery('
    ')},onShow:function(view,region,options){this.el.classList.add("is-visible");this.$overlay.on("click",jQuery.proxy(this.empty,this)).appendTo("body")},onEmpty:function(view,region,options){this.el.classList.remove("is-visible");this.$overlay.off().detach()}});module.exports=DialogRegion},{}],58:[function(require,module,exports){var DialogView=require("./show/dialog"),DialogModule;DialogModule=Marionette.Module.extend({onStart:function(){var api={showDialog:function(options){app.dialog.show(new DialogView(options))}};this.listenTo(app.channel,"dialog:open",api.showDialog);app.channel.trigger("module:dialog:ready",this)}});module.exports=DialogModule},{"./show/dialog":59}],59:[function(require,module,exports){var $=window.jQuery,DialogView;DialogView=Backbone.Marionette.ItemView.extend({className:"dialog",defaults:{title:"",content:"",button:""},ui:{close:".js-close",content:".dialog__content",save:".js-save"},events:{input:"onChange",change:"onChange"},triggers:{"click @ui.close":"close","click @ui.save":"save"},template:"#tmpl-tailor-dialog",serializeData:function(){return{title:this.title,content:this.content,button:this.button}},initialize:function(options){this.title=options.title||this.defaults.title;this.content=options.content||this.defaults.content;this.button=options.button||this.defaults.button;this.callbacks={validate:options.onValidate,open:options.onOpen,save:options.onSave,close:options.onClose}},onBeforeRender:function(){if("function"==typeof this.content){this.content=this.content.call(this)}},onDomRefresh:function(){if("function"===typeof this.callbacks.open){this.callbacks.open.call(this)}this.validate()},onChange:function(){this.validate()},validate:function(){if("function"===typeof this.callbacks.validate){this.ui.save.prop("disabled",!this.callbacks.validate.call(this))}},onSave:function(){if("function"===typeof this.callbacks.save){this.callbacks.save.call(this)}this.onClose()},onClose:function(){if("function"===typeof this.callbacks.close){this.callbacks.close.call(this)}this.triggerMethod("destroy")}});module.exports=DialogView},{}],60:[function(require,module,exports){var SnapshotsCollection=require("../../entities/collections/snapshots"),SnapshotMenuItem=require("./show/snapshot-menu-item"),HistoryModule;Tailor.Items.History=SnapshotMenuItem;HistoryModule=Marionette.Module.extend({onBeforeStart:function(){var module=this;module.collection=new SnapshotsCollection;var api={getSnapshot:function(id){if(id){return module.collection.findWhere({id:id})}return module.collection}};app.channel.reply("sidebar:history",api.getSnapshot)},onStart:function(options){this.l10n=options.l10n;this.addEventListeners();app.channel.trigger("module:history:ready",this)},addEventListeners:function(){this.listenTo(app.channel,"element:add",this.onAddElement);this.listenTo(app.channel,"element:copy",this.onCopyElement);this.listenTo(app.channel,"element:move",this.onMoveElement);this.listenTo(app.channel,"modal:apply",this.onEditElement);this.listenTo(app.channel,"element:delete",this.onDeleteElement);this.listenTo(app.channel,"element:resize",this.onResizeElement);this.listenTo(app.channel,"navigation:reorder",this.onReorderElement);this.listenTo(app.channel,"template:add",this.onAddTemplate);this.listenTo(app.channel,"history:restore",this.restoreSnapshot);this.listenTo(app.channel,"history:undo",this.undoStep);this.listenTo(app.channel,"history:redo",this.redoStep)},onAddElement:function(model){if("library"==model.get("collection")){this.saveSnapshot(this.l10n.added+" "+model.get("label"))}},onEditElement:function(modal,model){this.saveSnapshot(this.l10n.edited+" "+model.get("label"))},onCopyElement:function(model){this.saveSnapshot(this.l10n.copied+" "+model.get("label"))},onMoveElement:function(model){this.saveSnapshot(this.l10n.moved+" "+model.get("label"))},onDeleteElement:function(model){this.saveSnapshot(this.l10n.deleted+" "+model.get("label"))},onResizeElement:function(model){this.saveSnapshot(this.l10n.resized+" "+model.get("label"))},onReorderElement:function(model){this.saveSnapshot(this.l10n.reordered+" "+model.get("label"))},onAddTemplate:function(model){this.saveSnapshot(this.l10n.added+" "+this.l10n.template+" - "+model.get("label"))},saveSnapshot:function(label){this.collection.save(label)},restoreSnapshot:function(timestamp){this.collection.restore(timestamp)},undoStep:function(){this.collection.undo()},redoStep:function(){this.collection.redo()}});module.exports=HistoryModule},{"../../entities/collections/snapshots":46,"./show/snapshot-menu-item":61}],61:[function(require,module,exports){var $=Backbone.$,HistoryItem;HistoryItem=Marionette.ItemView.extend({events:{click:"restore",keypress:"onKeyPress"},template:"#tmpl-tailor-panel-history-item",initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this.model.collection,"change:active",this.toggleClass)},onRender:function(){this.toggleClass()},attachElContent:function(html){var $el=$(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("tabindex",0);return this},onKeyPress:function(e){if(13===e.which){this.restore()}},restore:function(){var timestamp=this.model.get("timestamp");app.channel.trigger("before:history:restore",timestamp);app.channel.trigger("history:restore",timestamp)},toggleClass:function(model){model=model||this.model.collection.getActive();this.$el.toggleClass("is-active",model===this.model)}});module.exports=HistoryItem},{}],62:[function(require,module,exports){var LibraryCollection=require("../../entities/collections/library"),LibraryMenuItem=require("./show/library-menu-item"),LibraryModule;Tailor.Items.Library=LibraryMenuItem;LibraryModule=Marionette.Module.extend({onBeforeStart:function(options){var collection=new LibraryCollection(options.library);var api={getLibraryItem:function(tag){if(tag){return collection.findWhere({tag:tag})}return collection}};app.channel.reply("sidebar:library",api.getLibraryItem)},onStart:function(){app.channel.trigger("module:library:ready",this)}});module.exports=LibraryModule},{"../../entities/collections/library":41,"./show/library-menu-item":63}],63:[function(require,module,exports){var $=Backbone.$,ElementMenuItem;ElementMenuItem=Marionette.ItemView.extend({events:{click:"onClick",keypress:"onKeyPress"},modelEvents:{"change:match":"onSearch"},behaviors:{Draggable:{}},onClick:function(){var el=this.el;if(el.classList.contains("is-inactive")){return}var onAnimationEnd=function(e){el.removeEventListener(window.animationEndName,onAnimationEnd);el.classList.remove("shake")};if(Modernizr.cssanimations){el.addEventListener(window.animationEndName,onAnimationEnd);el.classList.add("shake")}Tailor.Notify(window._l10n.dragElement,"warning")},getTemplate:function(){return"#tmpl-tailor-panel-library-item"; -},attachElContent:function(html){var $el=$(html);this.$el.replaceWith($el);this.setElement($el);return this},onSearch:function(model){this.el.style.display=!model.get("match")?"none":"block"}});module.exports=ElementMenuItem},{}],64:[function(require,module,exports){var ModalRegion=Backbone.Marionette.Region.extend({onShow:function(view,region,options){this.el.classList.add("is-visible");var rect=this.el.getBoundingClientRect();var width=this.el.style.width?this.el.style.width:rect.width;this.el.style.width=width+"px";if(!this.el.style.height){this.el.style.height=window.innerHeight-40+"px"}if(!this.el.style.top){this.el.style.top="20px"}if(!this.el.style.left){if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.el.style.left=20+"px"}else{this.el.style.left=window.innerWidth-(rect.width+20)+"px"}}this.updateClassName(width);this.listenTo(view,"modal:resize",this.onResize)},onResize:function(width,height){this.updateClassName(width)},updateClassName:function(width){this.$el.toggleClass("is-x-small",width<480).toggleClass("is-small",481=1200)},onEmpty:function(view,region,options){this.el.classList.remove("is-visible");this.stopListening(view,"modal:resize",this.onResize)}});module.exports=ModalRegion},{}],65:[function(require,module,exports){var ModalView=require("./show/modal"),ModalModule;ModalModule=Marionette.Module.extend({onStart:function(){var api={openModal:function(model){if(app.modal.hasView()){if(model===app.modal.currentView.model){return}app.modal.currentView.triggerMethod("close")}app.modal.show(new ModalView({model:model}))},closeModal:function(){app.modal.empty()}};this.listenTo(app.channel,"modal:open",api.openModal);this.listenTo(app.channel,"elements:reset",api.closeModal);app.channel.trigger("module:modal:ready",this)}});module.exports=ModalModule},{"./show/modal":68}],66:[function(require,module,exports){var EmptyModalView=Marionette.ItemView.extend({className:"empty",template:"#tmpl-tailor-modal-empty"});module.exports=EmptyModalView},{}],67:[function(require,module,exports){var EmptySectionView=Marionette.ItemView.extend({className:"empty",template:"#tmpl-tailor-section-default-empty"});module.exports=EmptySectionView},{}],68:[function(require,module,exports){var SectionCollectionView=require("./sections"),NavigationView=require("./tabs"),ModalView;ModalView=Marionette.LayoutView.extend({className:"modal",ui:{close:".js-close",apply:".js-apply"},behaviors:{Resizable:{ui:{handle:".modal__title"}}},triggers:{"click @ui.close":"close","click @ui.apply":"apply"},modelEvents:{destroy:"destroy"},template:"#tmpl-tailor-modal",regions:{tabs:"#tailor-modal-tabs",sections:"#tailor-modal-sections"},initialize:function(){this.isModified=false;this.settings=app.channel.request("sidebar:settings",this.model);this.addEventListeners();app.channel.trigger("modal:initialize",this,this.model)},addEventListeners:function(){this.listenTo(this.settings,"change",this.onChange)},onRender:function(){var model=this.model;var sections=app.channel.request("sidebar:sections",model);var controls=app.channel.request("sidebar:controls",model);this.showChildView("sections",new SectionCollectionView({element:model,collection:sections,controls:controls}));if(sections.length>1){this.showChildView("tabs",new NavigationView({collection:sections}));this.el.classList.add("has-sections")}model.collection.trigger("edit",model,true)},onShow:function(){this.ui.close.focus()},onChange:function(setting){this.isModified=true;this.ui.apply.attr("disabled",false);var model=this.model;if(!model.isTracking()){model.startTracking()}var update=setting.get("refresh");var jsRefresh=update.hasOwnProperty("method")&&"js"==update["method"];if(jsRefresh&&update.hasOwnProperty("dependencies")){for(var settingId in update["dependencies"]){if(update["dependencies"].hasOwnProperty(settingId)&&_.has(update["dependencies"][settingId],"condition")&&_.has(update["dependencies"][settingId],"value")){var targetSetting=setting.collection.get(settingId);if(targetSetting&&!Tailor.Helpers.checkCondition(update["dependencies"][settingId]["condition"],targetSetting.get("value"),update["dependencies"][settingId]["value"])){jsRefresh=false;break}}}}model.set("atts",this.atts(),{silent:jsRefresh});if(jsRefresh){model.trigger("change:setting",setting,model)}app.channel.trigger("canvas:reset")},onApply:function(){this.model.stopTracking();this.model.set("atts",this.atts());app.channel.trigger("modal:apply",this,this.model);this.triggerMethod("destroy")},onClose:function(){if(this.isModified){var applyChanges=confirm(window._l10n.confirmElement);if(true===applyChanges){this.triggerMethod("apply")}else{this.model.resetAttributes()}}app.channel.trigger("modal:close",this);this.triggerMethod("destroy")},onDestroy:function(){this.model.collection.trigger("edit",this.model,false);app.channel.trigger("modal:destroy",this,this.model)},atts:function(){var atts={};this.settings.each(function(setting){var value=setting.get("value");if(null!==value){atts[setting.get("id")]=value}},this);return atts}});module.exports=ModalView},{"./sections":70,"./tabs":72}],69:[function(require,module,exports){var ControlCollectionView=Marionette.CollectionView.extend({tagName:"ul",className:"controls controls--modal",emptyView:require("./empty-section"),getChildView:function(child){return Tailor.lookup(child.get("type"),false,"Controls")},childViewOptions:function(model,index){var options={model:model};if("list"===model.get("type")){options.element=this.element;options.collection=this.element.collection}return options},filter:function(child,index,collection){return child.get("section")===this.model.get("id")},initialize:function(options){this.model=options.model;this.element=options.element;this.addEventListeners()},addEventListeners:function(){this.listenTo(this.model.collection,"select",this.onSelect)},onSelect:function(model){this.$el.toggle(model===this.model)}});module.exports=ControlCollectionView},{"./empty-section":67}],70:[function(require,module,exports){var SectionCollectionView=Marionette.CollectionView.extend({childView:require("./section"),emptyView:require("./empty-modal"),childViewOptions:function(model,index){return{model:model,element:this.element,collection:this.controls}},initialize:function(options){this.element=options.element;this.controls=options.controls}});module.exports=SectionCollectionView},{"./empty-modal":66,"./section":69}],71:[function(require,module,exports){var NavigationItemView=Marionette.ItemView.extend({tagName:"li",className:"tab",attributes:{tabindex:0},events:{click:"select",keypress:"onKeyPress"},template:"#tmpl-tailor-modal-item",select:function(){this.triggerMethod("select")},onSelect:function(){this.model.trigger("select",this.model);this.el.focus()},onKeyPress:function(e){if(13===e.which){this.select()}}});module.exports=NavigationItemView},{}],72:[function(require,module,exports){var NavigationItemView=require("./tab"),NavigationView;NavigationView=Marionette.CollectionView.extend({tagName:"ul",className:"tabs",childView:NavigationItemView,childEvents:{select:"onSelect"},onRender:function(){if(this.collection.length>0){this.children.first().triggerMethod("select")}},onSelect:function(view){this.children.each(function(child){child.$el.toggleClass("is-active",view===child)})}});module.exports=NavigationView},{"./tab":71}],73:[function(require,module,exports){var Notify=window.Tailor.Notify,NotificationsModule;NotificationsModule=Marionette.Module.extend({onStart:function(){this.addEventListeners();app.channel.trigger("module:notifications:ready",this)},addEventListeners:function(){var l10n=window._l10n;this.listenTo(app.channel,"sidebar:save",function(){Notify(l10n.savedPage,"success")});this.listenTo(app.channel,"elements:restore",function(){Notify(l10n.restoreElements,"success")});this.listenTo(app.channel,"element:delete",function(){Notify(l10n.deletedElement,"success")});this.listenTo(app.channel,"template:save",function(){Notify(l10n.savedTemplate,"success")});this.listenTo(app.channel,"template:import",function(){Notify(l10n.importedTemplate,"success")});this.listenTo(app.channel,"template:add",function(){Notify(l10n.addedTemplate,"success")});this.listenTo(app.channel,"template:delete",function(){Notify(l10n.deletedTemplate,"success")})}});module.exports=NotificationsModule},{}],74:[function(require,module,exports){var PanelCollection=require("../../entities/collections/panels"),PanelLayoutView=require("./show/layout"),PanelMenuItem=require("./show/panel-menu-item"),PanelsModule;Tailor.Items.Panels=PanelMenuItem;PanelsModule=Marionette.Module.extend({onBeforeStart:function(options){var module=this;module.collection=new PanelCollection(options.panels);var api={getPanels:function(id){if(id){return module.collection.findWhere({id:id})}return module.collection}};app.channel.reply("sidebar:panels",api.getPanels)},onStart:function(){app.content.show(new PanelLayoutView({panels:app.channel.request("sidebar:panels"),sections:app.channel.request("sidebar:sections"),controls:app.channel.request("sidebar:controls"),settings:app.channel.request("sidebar:settings")}));app.channel.trigger("module:panels:ready",this)}});module.exports=PanelsModule},{"../../entities/collections/panels":42,"./show/layout":75,"./show/panel-menu-item":76}],75:[function(require,module,exports){var PanelsView=require("./panels"),PanelLayoutView;PanelLayoutView=Marionette.LayoutView.extend({ui:{pageTitle:".back-button"},className:"tailor-sidebar__layout",regions:{panels:"#tailor-sidebar-home",panel:"#tailor-sidebar-panel",section:"#tailor-sidebar-section"},childEvents:{"show:panel":"showPanel","show:section":"showSection","back:home":"displayHome","back:panel":"displayPanel"},template:function(){return document.getElementById("tmpl-tailor-sidebar-layout").innerHTML},initialize:function(options){this.panels=options.panels;this.sections=options.sections;this.controls=options.controls;this.settings=options.settings},onRender:function(){this.showChildView("panels",new PanelsView({collection:this.panels}))},showPanel:function(view){this.displayPanel();var collection=app.channel.request("sidebar:"+view.model.get("type"));var PanelView=Tailor.lookup(view.model.get("type"),false,"Panels");this.showChildView("panel",new PanelView({model:view.model,collection:collection}))},showSection:function(view){this.el.classList.add("section-visible");this.el.classList.remove("panel-visible");var SectionView=Tailor.lookup(view.model.get("type"),false,"Sections");this.showChildView("section",new SectionView({model:view.model,collection:this.controls,panel:this.panels.findWhere({id:view.model.get("panel")})}))},displayHome:function(view){this.el.classList.remove("panel-visible");this.el.classList.remove("section-visible");if(view){view.model.trigger("focus")}},displayPanel:function(view){this.el.classList.remove("section-visible");this.el.classList.add("panel-visible");if(view){view.model.trigger("focus")}}});module.exports=PanelLayoutView},{"./panels":78}],76:[function(require,module,exports){var $=Backbone.$,PanelItem;PanelItem=Marionette.ItemView.extend({events:{click:"onClick",keypress:"onKeyPress"},modelEvents:{focus:"onFocus"},template:"#tmpl-tailor-panel-default-item",attachElContent:function(html){var $el=$(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("tabindex",0);return this},onClick:function(){this.triggerMethod("show:panel")},onKeyPress:function(e){if(13===e.which){this.triggerMethod("show:panel")}},onFocus:function(){this.el.focus()}});module.exports=PanelItem},{}],77:[function(require,module,exports){var EmptyPanelView=Marionette.ItemView.extend({className:"empty",template:"#tmpl-tailor-home-empty"});module.exports=EmptyPanelView},{}],78:[function(require,module,exports){var PanelsView=Marionette.CompositeView.extend({getChildView:function(){return Tailor.lookup("panels",false,"Items")},childViewContainer:"#items",emptyView:require("./panels-empty"),behaviors:{Panel:{}},template:"#tmpl-tailor-home"});module.exports=PanelsView},{"./panels-empty":77}],79:[function(require,module,exports){var SectionCollection=require("../../entities/collections/sections"),DefaultMenuItem=require("./show/default-menu-item"),SectionsModule;Tailor.Items.Default=DefaultMenuItem;SectionsModule=Marionette.Module.extend({onBeforeStart:function(options){var module=this;module.collection={sidebar:new SectionCollection(options.sections)};var api={getSections:function(model){if(!model){return module.collection["sidebar"]}var cid=model.cid;if(!module.collection.hasOwnProperty(cid)){var itemDefinition=app.channel.request("sidebar:library",model.get("tag"));var sections=itemDefinition.get("sections")||[];module.collection[cid]=new SectionCollection(sections)}return module.collection[cid]}};app.channel.reply("sidebar:sections sidebar:default",api.getSections)},onStart:function(){app.channel.trigger("module:sections:ready",this)}});module.exports=SectionsModule},{"../../entities/collections/sections":44,"./show/default-menu-item":80}],80:[function(require,module,exports){var $=Backbone.$,DefaultItem;DefaultItem=Marionette.ItemView.extend({events:{click:"onClick",keypress:"onKeyPress"},modelEvents:{focus:"onFocus"},template:"#tmpl-tailor-panel-default-item",attachElContent:function(html){var $el=$(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("tabindex",0);return this},onClick:function(){this.triggerMethod("show:section")},onKeyPress:function(e){if(13===e.which){this.triggerMethod("show:section")}},onFocus:function(){this.el.focus()}});module.exports=DefaultItem},{}],81:[function(require,module,exports){var SettingCollection=require("../../entities/collections/settings"),ControlCollection=require("../../entities/collections/controls"),SettingsModule;SettingsModule=Marionette.Module.extend({onBeforeStart:function(options){var module=this;module.settings={sidebar:new SettingCollection(options.settings)};module.controls={sidebar:new ControlCollection(options.controls,{silent:false,settings:module.settings["sidebar"]})};var api={getControls:function(model){if(!model){return module.controls["sidebar"]}var cid=model.cid;if(!module.controls.hasOwnProperty(cid)){var itemDefinition=app.channel.request("sidebar:library",model.get("tag"));var controls=itemDefinition.get("controls")||[];var settings=api.getSettings(model);module.controls[cid]=new ControlCollection(controls,{silent:false,settings:settings})}return module.controls[cid]},getSettings:function(model){if(!model){return module.settings["sidebar"]}var cid=model.cid;if(!module.settings.hasOwnProperty(cid)){var itemDefinition=app.channel.request("sidebar:library",model.get("tag"));var settings=itemDefinition.get("settings")||[];module.settings[cid]=new SettingCollection(settings,{element:model})}module.settings[cid].load();return module.settings[cid]}};app.channel.reply("sidebar:controls",api.getControls);app.channel.reply("sidebar:settings",api.getSettings);this.listenTo(module.settings["sidebar"],"change",this.onChangeSetting)},onStart:function(){app.channel.trigger("module:settings:ready",this)},onChangeSetting:function(setting){app.channel.trigger("sidebar:setting:change",setting)}});module.exports=SettingsModule},{"../../entities/collections/controls":40,"../../entities/collections/settings":45}],82:[function(require,module,exports){var $=Backbone.$,l10n=window._l10n,TemplateMenuItem;TemplateMenuItem=Marionette.ItemView.extend({ui:{delete:".js-delete-template",download:".js-download-template",preview:".js-preview-template"},events:{click:"onClick"},modelEvents:{"change:match":"onSearch"},behaviors:{Draggable:{}},onClick:function(e){switch(e.target){case this.ui.download.get(0):this.download();break;case this.ui.delete.get(0):this.delete();break;case this.ui.preview.get(0):this.preview();break;default:var el=this.el;var onAnimationEnd=function(e){el.removeEventListener(window.animationEndName,onAnimationEnd);el.classList.remove("shake")};if(Modernizr.cssanimations){el.addEventListener(window.animationEndName,onAnimationEnd);el.classList.add("shake")}Tailor.Notify(l10n.dragTemplate,"warning")}},getTemplate:function(){return"#tmpl-tailor-panel-templates-item"},attachElContent:function(html){var $el=$(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("tabindex",0);return this},download:function(){var item=this;var id=item.model.get("id");window.ajax.send("tailor_load_template",{data:{template_id:id,nonce:window._nonces.loadTemplate},success:function(response){var model=item.model;var models=response.models;var label=model.get("label");id=label.replace(" ","-").toLowerCase();var json={id:id,label:label,tag:model.get("tag"),type:model.get("type"),models:models};json="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(json));var a=document.getElementById("download-template");a.setAttribute("href",json);a.setAttribute("download","tailor-template-"+id+"-"+Date.now()+".json");a.click();app.channel.trigger("template:download")}})},delete:function(){var that=this;window.ajax.send("tailor_delete_template",{data:{id:that.model.get("id"),nonce:window._nonces.deleteTemplate},success:function(){that.$el.slideUp(function(){that.model.trigger("destroy",that.model)});app.channel.trigger("template:delete")}})},preview:function(){window._urls.view+=(window._urls.view.split("?")[1]?"&":"?")+"template_preview=1&template_id="+this.model.get("id");window.open(window._urls.view,"_blank");app.channel.trigger("template:preview")},onSearch:function(model){this.el.style.display=!model.get("match")?"none":"block"}});module.exports=TemplateMenuItem},{}],83:[function(require,module,exports){var l10n=window._l10n,TemplatesPanel;TemplatesPanel=Marionette.CompositeView.extend({ui:{backButton:".back-button",save:".js-save-template",import:".js-import-template",searchForm:".search-form"},events:{"click @ui.save":"save","click @ui.import":"import"},triggers:{"click @ui.backButton":"back:home"},behaviors:{Panel:{}},emptyView:Tailor.Panels.Empty,emptyViewOptions:function(){return{type:this.model.get("type")}},template:"#tmpl-tailor-panel-templates",childViewContainer:"#items",getChildView:function(){return Tailor.lookup(this.model.get("type"),false,"Items")},serializeData:function(){var data=Marionette.ItemView.prototype.serializeData.apply(this,arguments);data.items=this.collection;return data},onShow:function(){this.ui.backButton.get(0).focus();if(0===this.collection.length){this.ui.searchForm.hide()}},onAddChild:function(){this.ui.searchForm.show()},onRemoveChild:function(){if(0===this.collection.length){this.ui.searchForm.hide()}},import:function(e){var panel=this;var options={title:l10n.importTemplate,content:document.querySelector("#tmpl-tailor-dialog-import-template").innerHTML,button:l10n.import,onOpen:function(){this.el.querySelector("#import-template").focus()},onValidate:function(){var input=this.el.querySelector("#import-template");var re=/(?:\.([^.]+))?$/;return input.value&&"json"===re.exec(input.value)[1]},onSave:function(){var input=this.el.querySelector("#import-template");var file=input.files[0];if(!file||file.name.match(/.+\.json/)){var reader=new FileReader;reader.onload=function(e){var defaults={label:"",tag:"",models:[],nonce:window._nonces.saveTemplate};var data=_.extend(defaults,JSON.parse(reader.result));data.models=JSON.stringify(data.models);panel.createTemplate(data,"import")};try{reader.readAsText(file)}catch(e){}}},onClose:function(){panel.ui.import.focus()}};app.channel.trigger("dialog:open",options)},save:function(){var selected=app.channel.request("canvas:element:selected");var elements=app.channel.request("canvas:elements");var models=[];var tag;if(selected&&"function"==typeof selected.get){var getChildren=function(id){_.each(elements.where({parent:id}),function(model){models.push(model.toJSON());getChildren(model.get("id"))})};if("child"==selected.get("type")){selected=selected.collection.get(selected.get("parent"))}getChildren(selected.get("id"));selected=selected.toJSON();selected.parent="";models.push(selected);tag=selected.tag}else{models=elements.models;tag="tailor_section"}var panel=this;app.channel.trigger("dialog:open",{title:l10n.saveTemplate,content:document.querySelector("#tmpl-tailor-dialog-save-template").innerHTML,button:l10n.save,onOpen:function(){this.el.querySelector("#save-template").focus()},onValidate:function(){var input=this.el.querySelector("#save-template");return input.value.trim()},onSave:function(){var input=this.el.querySelector("#save-template");var data={label:input.value,tag:tag,models:JSON.stringify(models),nonce:window._nonces.saveTemplate};panel.createTemplate(data,"save")},onClose:function(){panel.ui.save.focus()}})},createTemplate:function(data,action){action=action||"save";var panel=this;var collection=panel.collection;panel.ui.save.prop("disabled",true);panel.ui.import.prop("disabled",true);window.ajax.send("tailor_save_template",{data:data,success:function(response){collection.add({id:response.id,label:response.label,tag:response.tag,type:response.type});app.channel.trigger("template:"+action)},complete:function(){panel.ui.save.prop("disabled",false);panel.ui.import.prop("disabled",false)}})}});module.exports=TemplatesPanel},{}],84:[function(require,module,exports){var TemplateCollection=require("../../entities/collections/templates"),TemplatesPanel=require("./show/templates-panel"),TemplateItem=require("./show/template-menu-item"),TemplatesModule;Tailor.Panels.Templates=TemplatesPanel;Tailor.Items.Templates=TemplateItem;TemplatesModule=Marionette.Module.extend({onBeforeStart:function(options){var module=this;this.collection=new TemplateCollection(options.templates);var api={getTemplates:function(){return module.collection}};app.channel.reply("sidebar:templates",api.getTemplates)},onStart:function(){app.channel.trigger("module:templates:ready",this)}});module.exports=TemplatesModule},{"../../entities/collections/templates":47,"./show/template-menu-item":82,"./show/templates-panel":83}],85:[function(require,module,exports){var $=jQuery;var title=document.querySelector(".tailor__home .title");Tailor.Api.Setting.onChange("sidebar:_post_title",function(to,from){if(title.hasChildNodes()){var children=title.childNodes;for(var i=1;i0){for(var rule in rules){if(rules.hasOwnProperty(rule)){if(!rules[rule].hasOwnProperty("selectors")||!rules[rule].hasOwnProperty("declarations")){continue}var query=checkQuery(rules[rule].media);ruleSets[query]=ruleSets[query]||{};ruleSets[query][elementId]=ruleSets[query][elementId]||[];if(_.keys(rules[rule].declarations).length>0){ruleSets[query][elementId].push({selectors:rules[rule].selectors,declarations:rules[rule].declarations,setting:rules[rule].setting||settingId})}}}cssModule.addRules(ruleSets)}}})};app.listenTo(app.channel,"sidebar:setting:change",onSidebarChange);app.listenTo(app.channel,"element:setting:change",onElementChange);app.channel.on("module:css:stylesheets:ready",function(module){cssModule=module});function registerCallback(type,id,callback){if("function"===typeof callback){callbacks[type][id]=callbacks[type][id]||[];callbacks[type][id].push(callback)}}module.exports={onChange:function(id,callback){var parts=id.split(":");if(parts.length>=2&&_.contains(["sidebar","element"],parts[0])){registerCallback(parts[0],parts[1],callback)}}}},{}],2:[function(require,module,exports){var DraggableBehaviors=Marionette.Behavior.extend({events:{dragstart:"onDragStart",dragend:"onDragEnd",drag:"onDrag"},onDragStart:function(e){app.channel.trigger("canvas:dragstart",e.originalEvent,this.view)},onDrag:function(e){app.channel.trigger("canvas:drag",e.originalEvent,this.view)},onDragEnd:function(e){app.channel.trigger("canvas:dragend",e.originalEvent,this.view)}});module.exports=DraggableBehaviors},{}],3:[function(require,module,exports){var $=jQuery,Ajax;Ajax={url:window.ajaxurl,post:function(action,data){return ajax.send({data:_.isObject(action)?action:_.extend(data||{},{action:action})})},send:function(action,options){if(_.isObject(action)){options=action}else{options=options||{};options.data=_.extend(options.data||{},{action:action,tailor:1})}options=_.defaults(options||{},{type:"POST",url:ajax.url,context:this});return $.Deferred(function(deferred){if(options.success){deferred.done(options.success)}var onError=options.error?options.error:ajax.onError;deferred.fail(onError);delete options.success;delete options.error;$.ajax(options).done(function(response){if(response==="1"||response===1){response={success:true}}if(_.isObject(response)&&!_.isUndefined(response.success)){deferred[response.success?"resolveWith":"rejectWith"](this,[response.data])}else{deferred.rejectWith(this,[response])}}).fail(function(){deferred.rejectWith(this,arguments)})}).promise()},onError:function(response){if(!Tailor.Notify){console.error(response);return}if(response&&response.hasOwnProperty("message")){Tailor.Notify(response.message)}else if("0"==response){Tailor.Notify(window._l10n.expired)}else if("-1"==response){Tailor.Notify(window._l10n.invalid)}else{Tailor.Notify(window._l10n.error)}}};window.ajax=Ajax;module.exports=Ajax},{}],4:[function(require,module,exports){var Notification;require("./polyfills/transitions");Notification=function(options){this.options=_.extend({},this.defaults,options);this.el=document.createElement("div");this.el.className="notification notification--"+this.options.type;this.container=document.getElementById("tailor-notification-container")||document.body;this.initialize()};Notification.prototype={defaults:{message:"",type:"",ttl:3e3,onShow:function(){},onHide:function(){}},initialize:function(){this.el.innerHTML=this.options.message;this.container.insertBefore(this.el,this.container.firstChild)},show:function(){var notification=this;notification.el.classList.add("is-visible");if("function"==typeof notification.options.onShow){notification.options.onShow.call(notification)}notification.session=setTimeout(function(){notification.hide()},notification.options.ttl)},hide:function(){var obj=this;var onTransitionEnd=function(e){if(Modernizr.cssanimations){if(e.target!==obj.el){return false}obj.el.removeEventListener(window.transitionEndName,onTransitionEnd)}obj.container.removeChild(obj.el);if("function"==typeof obj.options.onShow){obj.options.onShow.call(obj)}};clearTimeout(obj.session);if(Modernizr.csstransitions){obj.el.addEventListener(window.transitionEndName,onTransitionEnd);obj.el.classList.remove("is-visible")}else{onTransitionEnd()}}};var notify=function(msg,type){var notification=new Notification({message:msg,type:type||"error"});notification.show()};module.exports=notify},{"./polyfills/transitions":7}],5:[function(require,module,exports){(function(){if("undefined"===typeof window.Element||"classList"in document.documentElement){return}var prototype=Array.prototype,push=prototype.push,splice=prototype.splice,join=prototype.join;function DOMTokenList(el){this.el=el;var classes=el.className.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var i=0;iparseInt(required,10);case"contains":if(_.isString(actual)){actual=actual.split(",")}if(_.isArray(required)){var intersection=_.intersection(required,actual);return 0!==intersection.length}return-1!==_.indexOf(actual,required)}}}};wp.media.view.settings.post.id=window.post.id;app.addRegions({content:"#tailor-sidebar-content",dialog:{selector:"#tailor-dialog-container",regionClass:require("./sidebar/modules/dialog/dialog-region")},modal:{selector:"#tailor-modal-container",regionClass:require("./sidebar/modules/modal/modal-region")}});Tailor.Models.Container=require("./sidebar/entities/models/element-container");Tailor.Models.Wrapper=require("./sidebar/entities/models/element-wrapper");Tailor.Models.Section=require("./sidebar/entities/models/element-wrapper");Tailor.Models.Default=require("./sidebar/entities/models/element");Tailor.Panels.Default=require("./sidebar/components/panels/panel-default");Tailor.Panels.Empty=require("./sidebar/components/panels/panel-empty");Tailor.Sections.Default=require("./sidebar/components/sections/section-default");Tailor.Controls.ButtonGroup=require("./sidebar/components/controls/button-group");Tailor.Controls.Checkbox=require("./sidebar/components/controls/checkbox");Tailor.Controls.Code=require("./sidebar/components/controls/code");Tailor.Controls.Colorpicker=require("./sidebar/components/controls/colorpicker");Tailor.Controls.Editor=require("./sidebar/components/controls/editor");Tailor.Controls.Gallery=require("./sidebar/components/controls/gallery");Tailor.Controls.Icon=require("./sidebar/components/controls/icon");Tailor.Controls.Image=require("./sidebar/components/controls/image");Tailor.Controls.InputGroup=require("./sidebar/components/controls/input-group");Tailor.Controls.Link=require("./sidebar/components/controls/link");Tailor.Controls.List=require("./sidebar/components/controls/list");Tailor.Controls.Radio=require("./sidebar/components/controls/radio");Tailor.Controls.Range=require("./sidebar/components/controls/range");Tailor.Controls.Select=require("./sidebar/components/controls/select");Tailor.Controls.SelectMulti=require("./sidebar/components/controls/select-multi");Tailor.Controls.Style=require("./sidebar/components/controls/style");Tailor.Controls.Switch=require("./sidebar/components/controls/switch");Tailor.Controls.Text=require("./sidebar/components/controls/text");Tailor.Controls.Textarea=require("./sidebar/components/controls/textarea");Tailor.Controls.Video=require("./sidebar/components/controls/video");Tailor.Controls.WidgetForm=require("./sidebar/components/controls/widget-form");Tailor.Controls.Default=require("./sidebar/components/controls/text");Tailor.Controls.Abstract=require("./sidebar/components/controls/abstract-control");function getName(string){string=string||"";return string.replace(/_|-|tailor_/gi," ").replace(/(?: |\b)(\w)/g,function(key){return key.toUpperCase().replace(/\s+/g,"")})}Tailor.lookup=function(tag,type,object){if(!Tailor.hasOwnProperty(object)){console.error("Object type "+object+" does not exist");return}var name=getName(tag);if(Tailor[object].hasOwnProperty(name)){return Tailor[object][name]}if(type){name=getName(type);if(Tailor[object].hasOwnProperty(name)){return Tailor[object][name]}}return Tailor[object].Default};app.on("start",function(options){app.module("module:library",require("./sidebar/modules/library/library"));app.module("module:templates",require("./sidebar/modules/templates/templates"));app.module("module:settings",require("./sidebar/modules/settings/settings"));app.module("module:history",require("./sidebar/modules/history/history"));app.module("module:sections",require("./sidebar/modules/sections/sections"));app.module("module:panels",require("./sidebar/modules/panels/panels"));app.module("module:modal",require("./sidebar/modules/modal/modal"));app.module("module:dialog",require("./sidebar/modules/dialog/dialog"));app.module("module:notification",require("./sidebar/modules/notifications/notifications"));app.module("module:devicePreview",require("./sidebar/modules/device-preview/device-preview"));require("./sidebar/preview");$doc.on("heartbeat-send",function(e,data){data["tailor_post_id"]=window.post.id});wp.heartbeat.interval(60);wp.heartbeat.connectNow();$win.on("beforeunload.tailor",function(e){if(app.hasUnsavedChanges()){return window._l10n.confirmPage}}).on("unload.tailor",function(e){window.ajax.send("tailor_unlock_post",{data:{post_id:options.postId,nonce:options.nonces.unlockPost}})})});$doc.ready(function(){app.start({postId:window.post.id,nonces:window._nonces,l10n:window._l10n||[],library:window._library||[],templates:window._templates||[],panels:window._panels||[],sections:window._sections||[],settings:window._settings||[],controls:window._controls||[]});app.channel.trigger("sidebar:initialize",app)})})(window,Backbone.$)},{"./shared/components/api/setting":1,"./shared/components/behaviors/draggable":2,"./shared/utility/ajax":3,"./shared/utility/notify":4,"./shared/utility/polyfills/classlist":5,"./shared/utility/polyfills/raf":6,"./shared/utility/polyfills/transitions":7,"./sidebar/app":9,"./sidebar/components/behaviors/panel":10,"./sidebar/components/behaviors/resizable":11,"./sidebar/components/controls/abstract-control":12,"./sidebar/components/controls/button-group":13,"./sidebar/components/controls/checkbox":14,"./sidebar/components/controls/code":15,"./sidebar/components/controls/colorpicker":16,"./sidebar/components/controls/editor":17,"./sidebar/components/controls/gallery":18,"./sidebar/components/controls/icon":19,"./sidebar/components/controls/image":20,"./sidebar/components/controls/input-group":21,"./sidebar/components/controls/link":22,"./sidebar/components/controls/list":25,"./sidebar/components/controls/radio":26,"./sidebar/components/controls/range":27,"./sidebar/components/controls/select":29,"./sidebar/components/controls/select-multi":28,"./sidebar/components/controls/style":30,"./sidebar/components/controls/switch":31,"./sidebar/components/controls/text":32,"./sidebar/components/controls/textarea":33,"./sidebar/components/controls/video":34,"./sidebar/components/controls/widget-form":35,"./sidebar/components/panels/panel-default":36,"./sidebar/components/panels/panel-empty":37,"./sidebar/components/sections/section-default":38,"./sidebar/entities/models/element":51,"./sidebar/entities/models/element-container":49,"./sidebar/entities/models/element-wrapper":50,"./sidebar/modules/device-preview/device-preview":56,"./sidebar/modules/dialog/dialog":58,"./sidebar/modules/dialog/dialog-region":57,"./sidebar/modules/history/history":60,"./sidebar/modules/library/library":62,"./sidebar/modules/modal/modal":65,"./sidebar/modules/modal/modal-region":64,"./sidebar/modules/notifications/notifications":73,"./sidebar/modules/panels/panels":74,"./sidebar/modules/sections/sections":79,"./sidebar/modules/settings/settings":81,"./sidebar/modules/templates/templates":84,"./sidebar/preview":85}],9:[function(require,module,exports){var $=Backbone.$,$doc=$(document),SidebarApplication;SidebarApplication=Marionette.Application.extend({el:document.querySelector("#tailor"),initialize:function(){this._collapsed=false;this._unsavedChanges=false;this.saveButton=document.querySelector("#tailor-save");this.allowableEvents=["canvas:initialize","element:add","element:move","element:resize","navigation:reorder","element:copy","element:delete","elements:restore","template:add","history:undo","history:redo","modal:open","modal:destroy"];this.addEventListeners()},hasUnsavedChanges:function(){return this._unsavedChanges},addEventListeners:function(){var sidebar=this;var events=["element:add","element:move","element:resize","navigation:reorder","element:copy","element:delete","modal:apply","template:add","sidebar:setting:change"];sidebar.listenTo(sidebar.channel,events.join(" "),function(){sidebar.saveButton.disabled=false;sidebar.saveButton.innerHTML=window._l10n.publish;sidebar._unsavedChanges=true});$("#tailor-collapse").on("click",function(){sidebar._collapsed=!sidebar._collapsed;sidebar.el.classList.toggle("is-collapsed",sidebar._collapsed);sidebar.saveButton.setAttribute("aria-expanded",!sidebar._collapsed);sidebar.triggerMethod("collapse:sidebar")});$(sidebar.saveButton).on("click",function(){sidebar.el.classList.add("is-saving");sidebar.saveButton.setAttribute("disabled",true);var models=sidebar.channel.request("canvas:elements");var settings=sidebar.channel.request("sidebar:settings");window.ajax.send("tailor_save",{data:{post_id:window.post.id,models:JSON.stringify(models.toJSON()),settings:JSON.stringify(settings.toJSON()),nonce:window._nonces.save},success:function(){sidebar.saveButton.disabled=true;sidebar.saveButton.innerHTML=window._l10n.saved;sidebar._unsavedChanges=false;sidebar.channel.trigger("sidebar:save")},error:function(response){sidebar.saveButton.disabled=false;if(response&&response.hasOwnProperty("message")){Tailor.Notify(response.message)}else if("0"==response){Tailor.Notify(window._l10n.expired)}else if("-1"==response){Tailor.Notify(window._l10n.invalid)}else{Tailor.Notify(window._l10n.error)}},complete:function(){sidebar.el.classList.remove("is-saving")}})});sidebar.listenTo(sidebar.channel,"canvas:handshake",sidebar.registerRemoteChannel);$doc.on("keydown",function(e){if(e.ctrlKey&&89==e.keyCode){if(!_.contains(["INPUT","SELECT","TEXTAREA"],e.target.tagName)){sidebar.channel.trigger("history:redo")}}});$doc.on("keydown",function(e){if(e.ctrlKey&&90==e.keyCode){if(!_.contains(["INPUT","SELECT","TEXTAREA"],e.target.tagName)){sidebar.channel.trigger("history:undo")}}})},registerRemoteChannel:function(){var sidebarApp=this;var iFrame=this.el.querySelector("#tailor-sidebar-preview");if(window.location.origin===iFrame.contentWindow.location.origin){var remoteChannel=iFrame.contentWindow.app.channel;app.channel.reply("canvas:elements",function(id){return remoteChannel.request("canvas:elements",id)});app.channel.reply("canvas:element:selected",function(){return remoteChannel.request("canvas:element:selected")});app.listenTo(remoteChannel,"all",sidebarApp.forwardRemoteEvent);app.el.classList.add("is-initialized");app.el.querySelector(".tailor-preview__viewport").classList.add("is-loaded")}},forwardRemoteEvent:function(eventName){if(_.contains(this.allowableEvents,eventName)){this.channel.trigger.apply(this.channel,arguments)}},maybeCollapse:function(e){if(13===e.keyCode){this.onCollapse()}},maybeSave:function(e){if(13===e.keyCode){this.onSave()}}});module.exports=SidebarApplication},{}],10:[function(require,module,exports){var PanelBehavior=Marionette.Behavior.extend({ui:{backButton:".back-button",helpButton:".help-button",helpDescription:".help-description",searchBar:".search"},events:{"click @ui.helpButton":"toggleHelp","change @ui.searchBar":"doSearch","input @ui.searchBar":"doSearch","keyup @ui.searchBar":"doSearch","search @ui.searchBar":"doSearch"},triggers:{"click @ui.backButton":"back"},toggleHelp:function(){this.ui.helpButton.toggleClass("is-open");this.ui.helpDescription.slideToggle(150)},doSearch:function(e){this.view.collection.doSearch(e.target.value)}});module.exports=PanelBehavior},{}],11:[function(require,module,exports){var ResizableBehavior=Marionette.Behavior.extend({ui:{handle:".modal__title"},events:{mousemove:"onMouseMove",mousedown:"onMouseDown","dblclick @ui.handle":"toggleFullScreen"},initialize:function(){this._isResizing=false;this._isResizing=false;this.$ghostPane=jQuery('
    ').appendTo("body");this.addEventListeners()},addEventListeners:function(){var behavior=this;window.addEventListener("resize",function(){behavior.checkPosition()},false)},detectEdges:function(e){var rect=this.el.getBoundingClientRect();var x=e.clientX-rect.left;var y=e.clientY-rect.top;var threshold=8;var edges=[];if(y=rect.height-threshold){edges.push("bottom")}if(x=rect.width-threshold){edges.push("right")}return edges},onMouseMove:function(e){if(this._isResizing||this._isDragging){return}this.$el.removeClass("top top-left top-right left right bottom bottom-left bottom-right is-draggable");var edges=this.detectEdges(e);if(edges.length&&!this.container.classList.contains("is-full-screen")&&!document.body.classList.contains("mce-fullscreen")){this.$el.addClass(edges.join("-"))}else if(e.target.classList.contains("modal__title")){this.el.classList.add("is-draggable")}},onMouseDown:function(e){if(this._isResizing||this._isDragging){return}var edges=this.detectEdges(e);if(edges.length&&!this.$container.hasClass("is-full-screen")&&!document.body.classList.contains("mce-fullscreen")){this.resize(e,edges)}else if(e.target===this.ui.handle.get(0)){this.drag(e)}},resize:function(e,edges){var that=this;var edge=edges.join("-");var direction=_.contains(edges,"top")||_.contains(edges,"left")?-1:1;this._isResizing=true;document.body.classList.add("is-dragging");document.addEventListener("mousemove",onResize,false);document.addEventListener("mouseup",onResizeEnd,false);var lastX=e.pageX;var lastY=e.pageY;var lastWidth=parseInt(that.container.style.width,10);var lastHeight=parseInt(that.container.style.height,10);function onResize(e){var xDifference=direction*(e.pageX-lastX);var yDifference=direction*(e.pageY-lastY);switch(edge){case"top":lastHeight=lastHeight+yDifference;if(lastHeight>400){that.container.style.height=lastHeight+"px";that.container.style.top=parseInt(that.container.style.top,10)-yDifference+"px"}break;case"bottom":lastHeight=lastHeight+yDifference;if(lastHeight>400){that.container.style.height=lastHeight+"px"}break;case"left":lastWidth=lastWidth+xDifference;if(lastWidth>300){that.container.style.width=lastWidth+"px";that.container.style.left=parseInt(that.container.style.left,10)-xDifference+"px"}break;case"right":lastWidth=lastWidth+xDifference;if(lastWidth>300){that.container.style.width=lastWidth+"px"}break;case"top-left":lastHeight=lastHeight+yDifference;lastWidth=lastWidth+xDifference;if(lastWidth>300){that.container.style.width=lastWidth+"px";that.container.style.left=parseInt(that.container.style.left,10)-xDifference+"px"}if(lastHeight>400){that.container.style.height=lastHeight+"px";that.container.style.top=parseInt(that.container.style.top,10)-yDifference+"px"}break;case"top-right":lastHeight=lastHeight+yDifference;lastWidth=lastWidth-xDifference;if(lastWidth>300){that.container.style.width=lastWidth+"px"}if(lastHeight>400){that.container.style.height=lastHeight+"px";that.container.style.top=parseInt(that.container.style.top,10)-yDifference+"px"}break;case"bottom-left":lastHeight=lastHeight-yDifference;lastWidth=lastWidth+xDifference;if(lastWidth>300){that.container.style.width=lastWidth+"px";that.container.style.left=parseInt(that.container.style.left,10)-xDifference+"px"}if(lastHeight>400){that.container.style.height=lastHeight+"px"}break;case"bottom-right":lastHeight=lastHeight+yDifference;lastWidth=lastWidth+xDifference;if(lastWidth>300){that.container.style.width=lastWidth+"px"}if(lastHeight>400){that.container.style.height=lastHeight+"px"}break}that.triggerResize(lastWidth,lastHeight);lastY=e.pageY;lastX=e.pageX}function onResizeEnd(e){that._isResizing=false;document.body.classList.remove("is-dragging");document.removeEventListener("mousemove",onResize,false);document.removeEventListener("mouseup",onResizeEnd,false);that.checkPosition(150)}},drag:function(e){var that=this;var lastX;var lastY;this._isDragging=true;document.addEventListener("mousemove",onDrag,false);document.addEventListener("mouseup",onDragEnd,false);function onDrag(e){document.body.classList.add("is-dragging");that.container.style.top=parseInt(that.container.style.top,10)+(e.pageY-lastY)+"px";that.container.style.left=parseInt(that.container.style.left,10)+(e.pageX-lastX)+"px";if(e.pageX<5){that.$ghostPane.css({display:"block"}).addClass("left")}else if(e.pageX>window.innerWidth-5){that.$ghostPane.css({display:"block"}).addClass("right")}else if(e.pageY<5){that.$ghostPane.css({display:"block"}).addClass("top")}else{that.resetGhostPane();if(that.container.classList.contains("is-full-screen")){that.$container.removeClass("is-full-screen is-full-screen-left is-full-screen-right");that.container.style.top=e.pageY-20+"px";that.container.style.left=e.pageX-parseInt(that.container.style.width,10)/2+"px";that.triggerResize(parseInt(that.container.style.width,10),parseInt(that.container.style.height,10))}}lastX=e.pageX;lastY=e.pageY}function onDragEnd(e){that._isDragging=false;document.body.classList.remove("is-dragging");document.removeEventListener("mousemove",onDrag,false);document.removeEventListener("mouseup",onDragEnd,false);that.maybeToggleFullScreen(e)}},maybeToggleFullScreen:function(e){var position;if(e.pageY<5){position="top"}else if(e.pageX<5){position="left"}else if(e.pageX>window.innerWidth-5){position="right"}if(position){this.enterFullScreen(position)}else{this.checkPosition(150)}},toggleFullScreen:function(){if(!this.container.classList.contains("is-full-screen")){this.enterFullScreen("top")}else{this.exitFullScreen()}},enterFullScreen:function(position){this.$container.removeClass("is-full-screen is-full-screen-left is-full-screen-right");this.container.classList.add("is-full-screen");this.container.classList.add("is-full-screen-"+position);var rect=this.container.getBoundingClientRect();this.triggerResize(rect.width,rect.height)},exitFullScreen:function(){this.$container.removeClass("is-full-screen is-full-screen-left is-full-screen-right");this.triggerResize(parseInt(this.container.style.width,10),parseInt(this.container.style.height,10));this.checkPosition(150);this.resetGhostPane()},triggerResize:function(width,height){this.view.trigger("modal:resize",width,height)},resetGhostPane:function(){this.$ghostPane.css({display:"none"});this.$ghostPane[0].className="ghost-pane"},onShow:function(){this.container=this.el.parentNode;this.$container=this.$el.parent();this.checkPosition()},checkPosition:function(duration){duration=duration||0;var width=parseInt(this.container.style.width,10);var height=parseInt(this.container.style.height,10);var top=parseInt(this.container.style.top,10);var left=parseInt(this.container.style.left,10);var css={};if(topwindow.scrollY+window.innerHeight){css.top=Math.max(window.scrollY+window.innerHeight-height,window.scrollY)}if(left<0){css.left=window.scrollX}else if(left+width>window.scrollX+window.innerWidth){css.left=Math.max(window.scrollX+window.innerWidth-width,window.scrollX)}if(duration){this.$container.animate(css,duration)}else{this.$container.css(css)}},onDestroy:function(){this.$ghostPane.remove()}});module.exports=ResizableBehavior},{}],12:[function(require,module,exports){var $=window.jQuery,AbstractControl;AbstractControl=Marionette.ItemView.extend({tagName:"li",media:"desktop",ui:{input:"input",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"blur @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},className:function(){return"control control--"+this.model.get("type")},getTemplate:function(){return"#tmpl-tailor-control-"+this.model.get("type")},serializeData:function(){var data=Backbone.Marionette.ItemView.prototype.serializeData.apply(this,arguments);data.values=this.getValues();data.hideDefault=this.checkDefault(data.values);data=this.addSerializedData(data);return data},addSerializedData:function(data){return data},checkDefault:function(values){var hide=true;_.each(this.getDefaults(),function(value,media){if(!_.isNull(value)&&values.hasOwnProperty(media)&&!_.isNull(values[media])&&value!==values[media]){hide=false}});return hide},initialize:function(){this.addEventListeners();this.checkDependencies()},addEventListeners:function(){_.each(this.getSettings(),function(setting){this.listenTo(setting,"change",this.onSettingChange)},this);this.listenTo(this.getSetting().collection,"change",this.checkDependencies)},checkDependencies:function(setting){setting=setting||this.getSetting();var dependencies=this.model.get("dependencies");var settingCollection=setting.collection;var visible=true;for(var id in dependencies){if(dependencies.hasOwnProperty(id)){var target=settingCollection.get(id);if(!target){continue}var condition=dependencies[id].condition;var actual=target.get("value");var required=dependencies[id].value;if(!Tailor.Helpers.checkCondition(condition,actual,required)){visible=false;break}}}this.$el.toggle(visible)},onRender:function(){this.updateControlGroups()},onMediaButtonChange:function(e){this.media=e.currentTarget.getAttribute("data-media");this.updateControlGroups()},onDefaultButtonChange:function(){this.restoreDefaults();this.render()},onFieldChange:function(){this.setValue(this.ui.input.filter('[name^="'+this.media+'"]').val())},onSettingChange:function(){this.updateDefaultButton()},updateControlGroups:function(){var media=this.media;this.ui.controlGroups.each(function(){$(this).toggleClass("is-hidden",media!=this.id)});this.ui.mediaButton.each(function(){$(this).toggleClass("active",media==this.getAttribute("data-media"))})},updateDefaultButton:function(){this.ui.defaultButton.toggleClass("is-hidden",this.checkDefault(this.getValues()))},getSettings:function(){return this.model.settings},getSetting:function(media){media=media||this.media;var settings=this.getSettings();for(var i in settings){if(settings.hasOwnProperty(i)){if(settings[i].media==media){return settings[i]}}}return false},getDefaults:function(){var defaults={};_.each(this.getSettings(),function(setting){defaults[setting.media]=setting.get("default")});return defaults},getValues:function(){var values={};_.each(this.getSettings(),function(setting){values[setting.media]=setting.get("value")||""});return values},getDefault:function(){return this.getSetting().get("default")},getValue:function(){return this.getSetting().get("value")},setValue:function(value){this.getSetting().set("value",value)},restoreDefaults:function(){_.each(this.getSettings(),function(setting){ +setting.set("value",setting.get("default"))})}});module.exports=AbstractControl},{}],13:[function(require,module,exports){var AbstractControl=require("./abstract-control"),ButtonGroupControl;ButtonGroupControl=AbstractControl.extend({ui:{input:".control__body .button",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{active:function(media,key){return key===this.values[media]?"active":""}},onFieldChange:function(e){this.ui.input.filter('[name^="'+this.media+'"]').removeClass("active");var button=e.currentTarget;button.classList.add("active");this.setValue(button.value)}});module.exports=ButtonGroupControl},{"./abstract-control":12}],14:[function(require,module,exports){var AbstractControl=require("./abstract-control"),CheckboxControl;CheckboxControl=AbstractControl.extend({events:{"change @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{checked:function(media,key){var values=this.values[media].split(",");return-1!==values.indexOf(key)?"checked":""}},onFieldChange:function(e){var values=[];_.each(this.ui.input.filter('[name^="'+this.media+'"]:checked'),function(field){if(field.checked){values.push(field.value||0)}});this.setValue(values.join(","))}});module.exports=CheckboxControl},{"./abstract-control":12}],15:[function(require,module,exports){var $=window.jQuery,AbstractControl=require("./abstract-control"),CodeControl;CodeControl=AbstractControl.extend({ui:{input:"textarea",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},addSerializedData:function(data){data.cid=this.cid;return data},onRender:function(){var control=this;var mode=control.model.get("mode");this.editors={};_.each(this.getValues(),function(value,media){var $field=control.ui.input.filter('[name^="'+media+"-"+control.cid+'"]');control.editors[media]=CodeMirror.fromTextArea($field.get(0),{mode:mode,lineNumbers:true,matchBrackets:true,continueComments:"Enter",viewportMargin:Infinity,extraKeys:{F11:function(cm){cm.setOption("fullScreen",!cm.getOption("fullScreen"))},Esc:function(cm){if(cm.getOption("fullScreen")){cm.setOption("fullScreen",false)}}}});control.editors[media].on("change",function(editor){control.setValue(editor.getValue())},this);setTimeout(function(){control.editors[media].refresh()},10)});this.updateControlGroups()},restoreDefaults:function(){_.each(this.getSettings(),function(setting,media){var value=setting.get("default")||"";setting.set("value",value)})},updateControlGroups:function(){var control=this;var media=this.media;this.ui.controlGroups.each(function(){$(this).toggleClass("is-hidden",media!=this.id)});this.ui.mediaButton.each(function(){$(this).toggleClass("active",media==this.getAttribute("data-media"))});control.editors[media].refresh()},onDestroy:function(){var control=this;_.each(this.getValues(),function(value,media){control.editors[media].off();control.editors[media].toTextArea()})}});module.exports=CodeControl},{"./abstract-control":12}],16:[function(require,module,exports){var $=window.jQuery,AbstractControl=require("./abstract-control"),ColorPickerControl;(function($){var image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==";var _before='
    ',_after='
    ',_wrap='
    ',_button='';Color.fn.toString=function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var hex=parseInt(this._color,10).toString(16);if(this.error)return"";if(hex.length<6){for(var i=6-hex.length-1;i>=0;i--){hex="0"+hex}}return"#"+hex};$.widget("wp.wpColorPicker",$.wp.wpColorPicker,{_create:function(){if(!$.support.iris){return}var self=this,el=self.element;$.extend(self.options,el.data());self.close=$.proxy(self.close,self);self.initialValue=el.val();el.addClass("wp-color-picker").hide().wrap(_wrap);self.wrap=el.parent();self.toggler=$(_before).insertBefore(el).css({backgroundColor:self.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current);self.pickerContainer=$(_after).insertAfter(el);self.button=$(_button);if(self.options.defaultColor){self.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString)}else{self.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear)}el.wrap('').after(self.button);el.iris({target:self.pickerContainer,hide:self.options.hide,width:self.options.width,mode:self.options.mode,palettes:self.options.palettes,change:function(event,ui){if(self.options.rgba){self.toggler.css({"background-image":"url("+image+")"}).html("");self.toggler.find("span").css({width:"100%",height:"100%",position:"absolute",top:0,left:0,"border-top-left-radius":"3px","border-bottom-left-radius":"3px",background:ui.color.toString()})}else{self.toggler.css({backgroundColor:ui.color.toString()})}if($.isFunction(self.options.change)){self.options.change.call(this,event,ui)}}});el.val(self.initialValue);self._addListeners();if(!self.options.hide){self.toggler.click()}},_addListeners:function(){var self=this;self.wrap.on("click.wpcolorpicker",function(event){event.stopPropagation()});self.toggler.click(function(){if(self.toggler.hasClass("wp-picker-open")){self.close()}else{self.open()}});self.element.change(function(event){var me=$(this),val=me.val();if(val===""||self.element.hasClass("iris-error")){if(self.options.rgba){self.toggler.removeAttr("style");self.toggler.find("span").css("backgroundColor","")}else{self.toggler.css("backgroundColor","")}if($.isFunction(self.options.clear)){self.options.clear.call(this,event)}}});self.toggler.on("keyup",function(event){if(event.keyCode===13||event.keyCode===32){event.preventDefault();self.toggler.trigger("click").next().focus()}});self.button.click(function(event){var me=$(this);if(me.hasClass("wp-picker-clear")){self.element.val("");if(self.options.rgba){self.toggler.removeAttr("style");self.toggler.find("span").css("backgroundColor","")}else{self.toggler.css("backgroundColor","")}if($.isFunction(self.options.clear)){self.options.clear.call(this,event)}}else if(me.hasClass("wp-picker-default")){self.element.val(self.options.defaultColor).change()}})}});$.widget("a8c.iris",$.a8c.iris,{_create:function(){this._super();this.options.rgba=this.element.data("rgba")||false;if(!this.element.is(":input")){this.options.alpha=false}if(typeof this.options.rgba!=="undefined"&&this.options.rgba){var self=this,_html='
    ',aContainer=$(_html).appendTo(self.picker.find(".iris-picker-inner")),aSlider=aContainer.find(".iris-slider-offset-alpha"),controls={aContainer:aContainer,aSlider:aSlider};$.each(controls,function(k,v){self.controls[k]=v});self.controls.square.css({"margin-right":"0"});var emptyWidth=self.picker.width()-self.controls.square.width()-20,stripsMargin=emptyWidth/6,stripsWidth=emptyWidth/2-stripsMargin;$.each(["aContainer","strip"],function(k,v){self.controls[v].width(stripsWidth).css({"margin-left":stripsMargin+"px"})});self._initControls();self._change()}},_initControls:function(){this._super();if(this.options.rgba){var self=this,controls=self.controls;controls.aSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(self._color._alpha*100),slide:function(event,ui){self._color._alpha=parseFloat(ui.value/100);self._change.apply(self,arguments)}})}},_change:function(){this._super();var self=this,el=self.element;if(this.options.rgba){var controls=self.controls,alpha=parseInt(self._color._alpha*100),color=self._color.toRgb(),gradient=["rgb("+color.r+","+color.g+","+color.b+") 0%","rgba("+color.r+","+color.g+","+color.b+", 0) 100%"],defaultWidth=self.options.defaultWidth,customWidth=self.options.customWidth,target=self.picker.closest(".wp-picker-container").find(".wp-color-result");controls.aContainer.css({background:"linear-gradient(to bottom, "+gradient.join(", ")+"), url("+image+")"});if(target.hasClass("wp-picker-open")){controls.aSlider.slider("value",alpha);if(self._color._alpha<1){var style=controls.strip.attr("style").replace(/rgba\(([0-9]+,)(\s+)?([0-9]+,)(\s+)?([0-9]+)(,(\s+)?[0-9\.]+)\)/g,"rgb($1$3$5)");controls.strip.attr("style",style);el.width(parseInt(defaultWidth+customWidth))}else{el.width(defaultWidth)}}}var reset=el.data("reset-alpha")||false;if(reset){self.picker.find(".iris-palette-container").on("click.palette",".iris-palette",function(){self._color._alpha=1;self.active="external";self._change()})}},_addInputListeners:function(input){var self=this,debounceTimeout=100,callback=function(event){var color=new Color(input.val()),val=input.val();input.removeClass("iris-error");if(color.error){if(val!==""){input.addClass("iris-error")}}else{if(color.toString()!==self._color.toString()){if(!(event.type==="keyup"&&val.match(/^[0-9a-fA-F]{3}$/))){self._setOption("color",color.toString())}}}};input.on("change",callback).on("keyup",self._debounce(callback,debounceTimeout));if(self.options.hide){input.one("focus",function(){self.show()})}}})})(jQuery);ColorPickerControl=AbstractControl.extend({addSerializedData:function(data){data.rgba=this.model.get("rgba");return data},onRender:function(){this.initWidgets();this.updateControlGroups()},onDefaultButtonChange:function(){this.restoreDefaults();this.destroyWidgets();this.render()},initWidgets:function(){var control=this;var defaults=this.getDefaults();var palettes=this.model.get("palettes");this.ui.input.each(function(){var $el=$(this);$el.wpColorPicker({palettes:palettes,defaultColor:defaults[this.name],change:function(){var color=control.ui.input.wpColorPicker("color");if("undefined"==typeof control.getValue()&&""==color){return}control.setValue($el.wpColorPicker("color"))},clear:function(){control.setValue("")}})})},destroyWidgets:function(){this.ui.input.each(function(){$(this).wpColorPicker("close")})},onBeforeDestroy:function(){this.destroyWidgets()}});module.exports=ColorPickerControl},{"./abstract-control":12}],17:[function(require,module,exports){var AbstractControl=require("./abstract-control"),EditorControl;EditorControl=AbstractControl.extend({ui:{input:"textarea",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"blur @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"restoreDefaults"},getTemplate:function(){var html=document.getElementById("tmpl-tailor-control-editor").innerHTML;return _.template(html.replace(new RegExp("tailor-editor","gi"),"<%= media %>-<%= cid %>").replace(new RegExp("tailor-value","gi"),"<%= values[ media ] %>"))},addSerializedData:function(data){data.cid=this.cid;return data},addEventListeners:function(){this.listenTo(this.getSetting().collection,"change",this.checkDependencies)},maybeRefreshEditor:function(el){if(el.contains(this.el)){_.each(this.getValues(),function(value,media){tinyMCE.execCommand("mceRemoveEditor",false,media+"-"+this.cid);tinyMCE.execCommand("mceAddEditor",false,media+"-"+this.cid)},this)}},onAttach:function(){var control=this;_.each(this.getValues(),function(value,media){var id=media+"-"+control.cid;var quickTagSettings=_.extend({},tinyMCEPreInit.qtInit["tailor-editor"],{id:id});quicktags(quickTagSettings);QTags._buttonsInit();tinyMCEPreInit.mceInit[id]=_.extend({},tinyMCEPreInit.mceInit["tailor-editor"],{id:id,resize:"vertical",height:350,setup:function(ed){ed.on("change",function(){ed.save();control.setValue(ed.getContent())})}});switchEditors.go(id,"tmce");tinymce.execCommand("mceAddEditor",true,id)},this)},restoreDefaults:function(){_.each(this.getSettings(),function(setting){var value=setting.get("default")||"";setting.set("value",value);var editor=tinyMCE.get(setting.media+"-"+this.cid);editor.setContent(value)},this)},onDestroy:function(){_.each(this.getValues(),function(value,media){tinyMCE.execCommand("mceRemoveEditor",true,media+"-"+this.cid)},this)}});module.exports=EditorControl},{"./abstract-control":12}],18:[function(require,module,exports){var AbstractControl=require("./abstract-control"),GalleryControl;GalleryControl=AbstractControl.extend({ui:{select:".button--select",change:".button--change",remove:".button--remove",thumbnails:".thumbnails",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.select":"selectImages","click @ui.change":"selectImages","click @ui.remove":"removeImages","click @ui.thumbnails":"selectImages","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},addSerializedData:function(data){data.ids={};_.each(data.values,function(value,media){data.ids[media]=this.getIds(value)},this);return data},selectImages:function(){_.each(this.getValues(),function(value,media){if(media==this.media){var control=this;var ids=control.getIds(value);var selection=this.getSelection(ids);var frame=wp.media({frame:"post",state:ids.length?"gallery-edit":"gallery-library",editing:true,multiple:true,selection:selection});var library;frame.on("open",function(){var mediaFrame=frame.views.get(".media-frame-menu")[0];mediaFrame.$el.children().slice(0,2).hide();library=JSON.stringify(selection.toJSON())}).on("update",function(collection){var value=collection.pluck("id").join(",");control.setValue(value);if(!_.isEqual(library,JSON.stringify(collection.toJSON()))){var setting=control.getSetting(media);setting.trigger("change",setting,value)}}).on("close",function(){frame.dispose()});frame.open()}},this)},getIds:function(value){if(_.isEmpty(value)){return false}return value.split(",")},removeImages:function(){this.setValue("")},onSettingChange:function(){this.render()},onRender:function(){var control=this;_.each(this.getValues(),function(value,media){var selection=this.getSelection(control.getIds(value));selection.more().done(function(){selection.props.set({query:false});selection.unmirror();selection.props.unset("orderby");control.updateThumbnails(selection,media)})},this);this.updateControlGroups()},updateThumbnails:function(selection,media){var html="";var urls=selection.map(function(attachment){var sizes=attachment.get("sizes");var url;if(sizes.hasOwnProperty("medium")){url=sizes.medium.url}else if(sizes.hasOwnProperty("thumbnail")){url=sizes.thumbnail.url}else if(sizes.hasOwnProperty("full")){url=sizes.full.url}else{url=""}return url});if(urls.length){_.each(urls,function(url){html+='
  • '})}this.ui.controlGroups.filter('[id^="'+media+'"]').find(".thumbnails").removeClass("is-loading").html(html)},getSelection:function(ids){var attachments=wp.media.query({orderby:"post__in",order:"ASC",type:"image",post__in:ids});return new wp.media.model.Selection(attachments.models,{props:attachments.props.toJSON(),multiple:true})}});module.exports=GalleryControl},{"./abstract-control":12}],19:[function(require,module,exports){var $=Backbone.$,AbstractControl=require("./abstract-control"),IconControl;IconControl=AbstractControl.extend({ui:{select:".button--select",change:".button--change",remove:".button--remove",icon:"i",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.select":"openDialog","click @ui.change":"openDialog","click @ui.remove":"removeIcon","click @ui.icon":"openDialog","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},openDialog:function(){var control=this;var options={title:"Select Icon",button:window._l10n.select,content:function(){var kits=window._kits||{};var value=control.getValue();if(_.keys(kits).length){return _.template(document.getElementById("tmpl-tailor-control-icon-select").innerHTML)({kits:kits,value:value})}return document.getElementById("tmpl-tailor-control-icon-empty").innerHTML},onOpen:function(){var $el=this.$el;var $li=$el.find("li");var $kits=$el.find(".icon-kit");this.$el.find(".search--icon").on("input",function(e){var term=this.value.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");term=term.replace(/ /g,")(?=.*");var match=new RegExp("^(?=.*"+term+").+","i");$li.each(function(){this.classList.toggle("is-hidden",!match.test(this.getAttribute("title")))})});this.$el.find(".select--icon").on("change",function(e){var kit=this.value;$kits.removeClass("is-hidden").filter(function(){return this.id!=kit}).addClass("is-hidden")})},onValidate:function(){return $("input[name=icon]:checked").val()},onSave:function(){control.setValue($("input[name=icon]:checked").val())},onClose:function(){this.$el.find(".search--icon").off("input")}};app.channel.trigger("dialog:open",options)},onSettingChange:function(){this.render()},removeIcon:function(){this.setValue("")}});module.exports=IconControl},{"./abstract-control":12}],20:[function(require,module,exports){var AbstractControl=require("./abstract-control"),ImageControl;ImageControl=AbstractControl.extend({ui:{select:".button--select",change:".button--change",remove:".button--remove",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *",thumbnail:".thumbnail"},events:{"click @ui.select":"openFrame","click @ui.change":"openFrame","click @ui.remove":"removeImage","click @ui.thumbnail":"openFrame","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},initialize:function(options){this.frame=wp.media({states:[new wp.media.controller.Library({title:"Select Image",library:wp.media.query({type:["image"]}),multiple:false,date:false})]});this.addEventListeners();this.checkDependencies()},addEventListeners:function(){_.each(this.getSettings(),function(setting){this.listenTo(setting,"change",this.onSettingChange)},this);this.listenTo(this.getSetting().collection,"change",this.checkDependencies);this.frame.on("select",this.selectImage.bind(this))},openFrame:function(){this.frame.open()},selectImage:function(){var selection=this.frame.state().get("selection");var attachment=selection.first();var sizes=attachment.get("sizes");this.setValue(attachment.get("id"))},updateThumbnail:function(sizes,media){var url;if(sizes.hasOwnProperty("medium")){url=sizes.medium.url}else if(sizes.hasOwnProperty("thumbnail")){url=sizes.thumbnail.url}else if(sizes.hasOwnProperty("full")){url=sizes.full.url}else{return}this.ui.controlGroups.filter('[id^="'+media+'"]').find(".thumbnails").removeClass("is-loading").html('
  • ')},removeImage:function(){this.setValue("")},onSettingChange:function(){this.render()},onRender:function(){_.each(this.getValues(),function(value,media){if(value){var attachment=wp.media.attachment(value);var sizes=attachment.get("sizes");if(sizes){this.updateThumbnail(sizes,media)}else{var control=this;attachment.fetch({success:function(){sizes=attachment.get("sizes");control.updateThumbnail(sizes,media)}})}}},this);this.updateControlGroups()},onDestroy:function(){this.frame.off().dispose()}});module.exports=ImageControl},{"./abstract-control":12}],21:[function(require,module,exports){var AbstractControl=require("./abstract-control"),InputGroup;InputGroup=AbstractControl.extend({addSerializedData:function(data){data.choices=this.model.get("choices");data.values={};_.each(this.getValues(),function(value,media){data.values[media]={};var values=[];if(_.isString(value)){if(-1!=value.indexOf(",")){values=value.split(",")}else{values=value.split("-")}}var i=0;for(var choice in data.choices){if(data.choices.hasOwnProperty(choice)){data.values[media][choice]=values[i];i++}}});return data},onFieldChange:function(e){var fields=this.ui.input.filter('[name^="'+this.media+'"]').serializeArray();var values=_.map(fields,function(field){return field.value});this.setValue(values.join(","))}});module.exports=InputGroup},{"./abstract-control":12}],22:[function(require,module,exports){var $=Backbone.$,AbstractControl=require("./abstract-control"),LinkControl;LinkControl=AbstractControl.extend({ui:{input:"input",select:".button--select",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"blur @ui.input":"onFieldChange","click @ui.select":"openDialog","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},addSerializedData:function(data){data.placeholder=this.model.get("placeholder");return data},search:function(term){var control=this;var $searchResults=this.$el.find(".search-results");if($searchResults.length){control.$el.addClass("is-searching");var options={data:{s:term,nonce:window._nonces.query},success:function(response){$searchResults.html(response)},complete:function(){control.$el.removeClass("is-searching")}};window.ajax.send("tailor_get_links",options)}},openDialog:function(){var control=this;var options={title:"Select content",button:window._l10n.select,content:function(){return'
    '+''+''+'
    '+"
    "},onOpen:function(){var dialog=this;var previousTerm="";var minimumCharacters=3;var timeout;this.$el.find(".search--content").on("input",function(e){clearTimeout(timeout);var term=this.value;if(term.length>=minimumCharacters&&previousTerm!=$.trim(term)){timeout=setTimeout($.proxy(control.search,dialog,term),500)}})},onValidate:function(){return $("input[name=url]:checked").val()},onSave:function(){var url=$("input[name=url]:checked").val();control.setValue(url)},onClose:function(){this.$el.find(".search--content").off("input")}};app.channel.trigger("dialog:open",options)},onSettingChange:function(){this.render()}});module.exports=LinkControl},{"./abstract-control":12}],23:[function(require,module,exports){var EmptyListView=Marionette.ItemView.extend({template:"#tmpl-tailor-control-list-empty"});module.exports=EmptyListView},{}],24:[function(require,module,exports){var ListItemControl=Marionette.CompositeView.extend({tagName:"li",className:"list-item",ui:{title:".list-item__title",content:".list-item__content",delete:".js-delete-list-item",close:".js-close-list-item"},triggers:{"click @ui.title":"toggle","click @ui.close":"toggle","click @ui.delete":"delete"},events:{keypress:"onKeyPress"},getChildView:function(child){return Tailor.lookup(child.get("type"),false,"Controls")},childViewContainer:"#controls",template:"#tmpl-tailor-control-list-item",initialize:function(options){this.settings=options.settings;this._open=false;this.model.startTracking();this.addEventListeners()},addEventListeners:function(){this.listenTo(this.settings,"change",this.onChangeSettings);this.listenTo(app.channel,"modal:apply",this.onApplyModal);this.listenTo(app.channel,"modal:close",this.onCloseModal)},updateTitle:function(from,to){this.ui.title.find(":contains("+from+")").html(to)},onKeyPress:function(e){if(13===e.which){this.triggerMethod("toggle")}},onToggle:function(){if(this._open){this.slideUp()}else{this.slideDown()}},slideUp:function(){var control=this;control._open=false;control.ui.content.slideUp(150,function(){control.el.classList.remove("is-open")})},slideDown:function(){var control=this;control._open=true;control.ui.content.slideDown(150,function(){control.el.classList.add("is-open")})},onDelete:function(){var control=this;control.$el.slideUp(250,function(){control.triggerMethod("remove")})},onChangeSettings:function(setting){var atts=_.clone(this.model.get("atts"));var settingId=setting.get("id");var settingValue=setting.get("value");if("title"==settingId){this.updateTitle(atts.title,settingValue)}atts[settingId]=settingValue;this.model.set("atts",atts)},onApplyModal:function(){this.model.stopTracking()},onCloseModal:function(){this.model.resetAttributes()}});module.exports=ListItemControl},{}],25:[function(require,module,exports){var ListControl=Marionette.CompositeView.extend({childView:require("./list-item"),childViewContainer:"#list-items",emptyView:require("./list-empty"),className:function(){return"control control--"+this.model.get("type")},ui:{button:".js-add"},events:{"click @ui.button":"addItem"},collectionEvents:{add:"updateContent",remove:"updateContent",change:"updateContent"},childEvents:{remove:"deleteItem",toggle:"onToggleItem"},template:"#tmpl-tailor-control-list",serializeData:function(){var data=Backbone.Marionette.ItemView.prototype.serializeData.apply(this,arguments);data.childLabel=this.child.get("label").toLowerCase();return data},childViewOptions:function(model,index){var controlCollection=app.channel.request("sidebar:controls",model);var settingCollection=app.channel.request("sidebar:settings",model);var options={model:model,collection:controlCollection,settings:settingCollection};return options},initialize:function(options){this.element=options.element;this._added=[];this._deleted=[];var listItemDefinition=app.channel.request("sidebar:library",this.element.get("tag"));this.child=app.channel.request("sidebar:library",listItemDefinition.get("child"));this.addEventListeners()},addEventListeners:function(){this.listenTo(app.channel,"modal:apply",this.onApplyModal);this.listenTo(app.channel,"modal:close",this.onCloseModal)},filter:function(child,index,collection){return child.get("parent")==this.element.get("id")},onRender:function(){var listControl=this;this.sortable=Sortable.create(this.$childViewContainer.get(0),{draggable:".list-item",handle:".list-item__title",animation:250,onEnd:function(e){app.channel.trigger("list:change:order",listControl.el);listControl.updateOrder()}})},isEmpty:function(){return this.collection.getChildren(this.element).length==0},onToggleItem:function(child){this.children.each(function(childView){if(childView!==child){childView.slideUp()}},this)},onAddChild:function(child){this.children.each(function(childView){if(childView!==child){childView.slideUp()}},this)},addItem:function(){var numberChildren=this.collection.getChildren(this.element).length;var item=_.first(this.collection.create([{tag:this.child.get("tag"),parent:this.element.get("id"),order:numberChildren,atts:{title:this.child.get("label")}}],{}));this._added.push(item)},deleteItem:function(view){for(var i=0;i *"},events:{"input @ui.range":"onFieldChange","blur @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{inputAttrs:function(){var atts="";_.each(this.attrs,function(value,attr){atts+=attr+'="'+value+'"'});return atts}},addSerializedData:function(data){data.attrs=this.model.get("input_attrs");return data},onFieldChange:function(e){var value=e.target.value;this.ui.input.filter('[name^="'+this.media+'"]').val(value);this.ui.range.filter('[name^="'+this.media+'"]').val(value);this.setValue(value)}});module.exports=RangeControl},{"./abstract-control":12}],28:[function(require,module,exports){var AbstractControl=require("./abstract-control"),SelectMultiControl;SelectMultiControl=AbstractControl.extend({ui:{input:"select",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"change @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{selected:function(media,key){var values=this.values[media].split(",");return-1!==values.indexOf(key)?"selected":""}},onRender:function(){_.each(this.getValues(),function(value,media){var $field=this.ui.input.filter('[name^="'+media+'"]');$field.select2()},this);this.updateControlGroups()},onFieldChange:function(){var $field=this.ui.input.filter('[name^="'+this.media+'"]');var field=$field.get(0);var values=[];for(var i=0;i *"},events:{"change @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{selected:function(media,key){return key===this.values[media]?"selected":""}}});module.exports=SelectControl},{"./abstract-control":12}],30:[function(require,module,exports){var $=window.jQuery,AbstractControl=require("./abstract-control"),StyleControl;StyleControl=AbstractControl.extend({linked:true,ui:{input:"input",mediaButton:".js-setting-group .button",defaultButton:".js-default",linkButton:".js-link",controlGroups:".control__body > *"},events:{"input @ui.input":"updateLinkedFields","blur @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange","click @ui.linkButton":"onLinkButtonChange"},addSerializedData:function(data){data.choices=this.model.get("choices");data.values={};_.each(this.getValues(),function(value,media){data.values[media]={};var values=[];if(_.isString(value)){if(-1!=value.indexOf(",")){values=value.split(",")}else{values=value.split("-")}}var i=0;for(var choice in data.choices){if(data.choices.hasOwnProperty(choice)){ +data.values[media][choice]=values[i];i++}}});return data},onRender:function(){this.updateControlGroups();this.updateLinkButton()},onLinkButtonChange:function(){this.linked=!this.linked;this.updateLinkButton()},onFieldChange:function(e){var fields=this.ui.input.filter('[name^="'+this.media+'"]').serializeArray();var values=_.map(fields,function(field){return field.value});this.setValue(values.join(","))},updateLinkButton:function(){this.ui.linkButton.toggleClass("is-active",this.linked)},updateLinkedFields:function(e){if(this.linked){this.ui.input.filter('[name^="'+this.media+'"]').filter(function(i,el){return el!=e.currentTarget}).val(e.currentTarget.value)}}});module.exports=StyleControl},{"./abstract-control":12}],31:[function(require,module,exports){var AbstractControl=require("./abstract-control"),SwitchControl;SwitchControl=AbstractControl.extend({events:{"change @ui.input":"onFieldChange","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},templateHelpers:{checked:function(media){return 1==parseInt(this.values[media],10)?"checked":""}},onFieldChange:function(){var $field=this.ui.input.filter('[name^="'+this.media+'"]');this.setValue($field.get(0).checked?"1":"0")}});module.exports=SwitchControl},{"./abstract-control":12}],32:[function(require,module,exports){var AbstractControl=require("./abstract-control"),TextControl;TextControl=AbstractControl.extend({templateHelpers:{inputAttrs:function(){var atts="";_.each(this.attrs,function(value,attr){atts+=attr+'="'+value+'"'});return atts}},addSerializedData:function(data){data.attrs=this.model.get("input_attrs");return data}});module.exports=TextControl},{"./abstract-control":12}],33:[function(require,module,exports){var AbstractControl=require("./abstract-control"),TextareaControl;TextareaControl=AbstractControl.extend({ui:{input:"textarea",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"}});module.exports=TextareaControl},{"./abstract-control":12}],34:[function(require,module,exports){var $=Backbone.$,AbstractControl=require("./abstract-control"),VideoControl;VideoControl=AbstractControl.extend({ui:{select:".button--select",enterUrl:".button--enter",change:".button--change",remove:".button--remove",mediaButton:".js-setting-group .button",defaultButton:".js-default",controlGroups:".control__body > *"},events:{"click @ui.select":"openFrame","click @ui.enterUrl":"openDialog","click @ui.change":"openFrame","click @ui.remove":"removeVideo","click @ui.mediaButton":"onMediaButtonChange","click @ui.defaultButton":"onDefaultButtonChange"},initialize:function(options){this.frame=wp.media({states:[new wp.media.controller.Library({title:"Select Video",library:wp.media.query({type:["video"]}),multiple:false,date:false})]});this.addEventListeners();this.checkDependencies()},addEventListeners:function(){_.each(this.getSettings(),function(setting){this.listenTo(setting,"change",this.onSettingChange)},this);this.listenTo(this.getSetting().collection,"change",this.checkDependencies);this.frame.on("select",this.selectVideo.bind(this))},openFrame:function(){this.frame.open()},selectVideo:function(){var selection=this.frame.state().get("selection");var attachment=selection.first();this.setValue(attachment.get("id"))},openDialog:function(){var control=this;var options={title:"Enter URL",button:window._l10n.select,content:function(){return'
    '+''+"
    "},onValidate:function(){var url=$(".search--content").val();return url&&/^(ftp|http|https):\/\/[^ "]+$/.test(url)},onSave:function(){control.setValue($(".search--content").val())},onClose:function(){this.$el.find(".search--content").off("input")}};app.channel.trigger("dialog:open",options)},onSettingChange:function(){this.render()},removeVideo:function(){this.setValue("")},onRender:function(){var control=this;_.each(this.getValues(),function(value,media){if(value){var attachment=wp.media.attachment(value);if(!attachment.get("url")){attachment.fetch({success:function(){control.updatePreview(attachment,media)}})}else{control.updatePreview(attachment,media)}}},this);this.updateControlGroups()},updatePreview:function(attachment,media){var url=attachment.get("url");var mime=attachment.get("mime");this.ui.controlGroups.filter('[id^="'+media+'"]').find(".video-preview").removeClass("is-loading").html('')},onDestroy:function(){this.frame.dispose()}});module.exports=VideoControl},{"./abstract-control":12}],35:[function(require,module,exports){var $=window.jQuery,AbstractControl=require("./abstract-control"),WidgetFormControl;WidgetFormControl=AbstractControl.extend({ui:{},events:{"blur *":"onFieldChange","change *":"onFieldChange"},getTemplateId:function(){return"tmpl-tailor-widget-form-"+this.model.get("widget_id_base")},getTemplate:function(){var el=document.getElementById(this.getTemplateId());var template="";if(el){template=_.template(el.innerHTML)}return template},onRender:function(){var idBase=this.model.get("widget_id_base");var $el=this.$el;this.$el.find("label").addClass("control__title").each(function(){var $label=$(this);$label.html(this.innerHTML.replace(":",""))});_.each(this.getValues(),function(value,media){if(!_.isEmpty(value)){var values=JSON.parse(value);_.each(values,function(value,name){var $field=$el.find('[name="widget-'+idBase+"[__i__]["+name+']"]');if($field.length){if("checkbox"==$field[0].type||"radio"==$field[0].type){$field.attr("checked","true")}else{$field.val(value)}}})}},this)},onFieldChange:function(e){var fields=this.$el.find("input, select, radio, textarea").serializeArray();var values={};$.each(fields,function(){var matches=this.name.match(/\[(.*?)\]/g);if(matches&&2==matches.length){var name=matches[1].substring(1,matches[1].length-1);if("undefined"!=typeof values[name]){if(!values[name].push){values[name]=[values[name]]}values[name].push(this.value||"")}else{values[name]=this.value||""}}});this.setValue(JSON.stringify(values));e.preventDefault();e.stopImmediatePropagation()},onSettingChange:function(){}});module.exports=WidgetFormControl},{"./abstract-control":12}],36:[function(require,module,exports){var DefaultPanel=Marionette.CompositeView.extend({ui:{backButton:".back-button"},triggers:{"click @ui.backButton":"back:home"},behaviors:{Panel:{}},emptyView:Tailor.Panels.Empty,emptyViewOptions:function(){return{type:this.model.get("type")}},childViewContainer:"#items",getChildView:function(){return Tailor.lookup(this.model.get("type"),false,"Items")},filter:function(child,index,collection){switch(this.model.get("type")){case"library":return!_.contains(["tailor_row"],child.get("tag"))&&"child"!=child.get("type");break;case"default":return child.get("panel")===this.model.get("id");break;default:return true;break}},getTemplate:function(){var type=this.model.get("type")||"default";return"#tmpl-tailor-panel-"+type},serializeData:function(){var data=Marionette.ItemView.prototype.serializeData.apply(this,arguments);data.items=this.collection;return data},onShow:function(){this.ui.backButton.get(0).focus()}});module.exports=DefaultPanel},{}],37:[function(require,module,exports){var EmptyPanelView=Marionette.ItemView.extend({className:"empty",initialize:function(options){this.type=options.type},getTemplate:function(){var type=this.type||"default";return"#tmpl-tailor-panel-"+type+"-empty"}});module.exports=EmptyPanelView},{}],38:[function(require,module,exports){var DefaultSection=Marionette.CompositeView.extend({ui:{backButton:".back-button"},triggers:{"click @ui.backButton":"back:panel"},behaviors:{Panel:{}},emptyView:require("./section-empty"),childViewContainer:"#controls",initialize:function(options){this.panel=options.panel},getChildView:function(child){return Tailor.lookup(child.get("type"),false,"Controls")},filter:function(child,index,collection){if("default"===this.model.get("type")){return child.get("section")===this.model.get("id")}return true},getTemplate:function(){return"#tmpl-tailor-section-"+this.model.get("type")},serializeData:function(){var data=Marionette.ItemView.prototype.serializeData.apply(this,arguments);data.panel=this.panel.get("title");return data},onShow:function(){this.ui.backButton.get(0).focus()}});module.exports=DefaultSection},{"./section-empty":39}],39:[function(require,module,exports){var EmptySectionView=Marionette.ItemView.extend({className:"empty",getTemplate:function(){var type=this.model.get("type")||"default";return"#tmpl-tailor-section-"+type+"-empty"}});module.exports=EmptySectionView},{}],40:[function(require,module,exports){var ControlCollection=Backbone.Collection.extend({model:require("../models/control"),initialize:function(models,options){if(options&&options.settings){this.settings=options.settings}this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"reset",this.onReset)},onReset:function(){var mediaQueries=[];for(var mediaQueryId in _media_queries){if(_media_queries.hasOwnProperty(mediaQueryId)&&""!=_media_queries[mediaQueryId].max){mediaQueries.push(mediaQueryId)}}this.each(function(model){var settingId=model.get("setting");model.settings=this.settings.filter(function(setting){var id=setting.get("id");if(id==settingId){setting.media="desktop";return true}else{var index=_.indexOf(mediaQueries,id.replace(settingId+"_",""));if(-1!==index){setting.media=mediaQueries[index];return true}}return false})},this)}});module.exports=ControlCollection},{"../models/control":48}],41:[function(require,module,exports){var SearchableCollection=require("./searchable"),LibraryCollection;LibraryCollection=SearchableCollection.extend({model:function(attrs,options){var Model=Tailor.lookup(attrs.tag,attrs.type,"Models");return new Model(attrs,options)},comparator:"label",getHaystack:function(model){return[model.get("label"),model.get("type"),model.get("description"),model.get("badge"),model.get("tag")].join(" ")}});module.exports=LibraryCollection},{"./searchable":43}],42:[function(require,module,exports){var PanelCollection=Backbone.Collection.extend({model:require("../models/panel")});module.exports=PanelCollection},{"../models/panel":52}],43:[function(require,module,exports){var $=Backbone.$,SearchableCollection;SearchableCollection=Backbone.Collection.extend({doSearch:function(value){if(this.terms===value){return}this.terms=value;if(this.terms.length>0){this.search(this.terms)}if(this.terms===""){this.each(function(item){item.set("match",true)})}},search:function(term){var match,haystack;term=term.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&");term=term.replace(/ /g,")(?=.*");match=new RegExp("^(?=.*"+term+").+","i");this.each(function(item){haystack=this.getHaystack(item);item.set("match",match.test(haystack))},this)}});module.exports=SearchableCollection},{}],44:[function(require,module,exports){var SectionCollection=Backbone.Collection.extend({model:require("../models/section")});module.exports=SectionCollection},{"../models/section":53}],45:[function(require,module,exports){var SettingCollection=Backbone.Collection.extend({model:require("../models/setting"),initialize:function(models,options){if(options&&options.element){this.element=options.element}this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"reset",this.load)},load:function(){var atts=this.element.get("atts");this.each(function(model){model.set("value",atts[model.get("id")])},this)}});module.exports=SettingCollection},{"../models/setting":54}],46:[function(require,module,exports){var SnapshotCollection=Backbone.Collection.extend({maxSize:50,active:null,comparator:function(model){return-model.get("timestamp")},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"add",this.checkLength);this.listenToOnce(app.channel,"canvas:initialize",function(){this.elements=app.channel.request("canvas:elements");this.save(window._l10n.initialized)})},save:function(label){if(this.active){var activePosition=this.indexOf(this.active);if(activePosition>0){this.remove(this.slice(0,activePosition))}}var entry=this.add({label:label||"",elements:this.elements?this.elements.toJSON():[],time:this.getTime(),timestamp:_.now()});this.setActive(entry)},getTime:function(){var date=new Date;var hours=date.getHours();var separator=":";var suffix;if(hours>12){hours-=12;suffix=" PM"}else{suffix=" AM"}return hours+separator+("0"+date.getMinutes()).slice(-2)+separator+("0"+date.getSeconds()).slice(-2)+suffix},restore:function(timestamp){var entry=this.findWhere({timestamp:timestamp});if(!entry||entry===this.getActive()){return}this.setActive(entry);var elements=entry.get("elements");app.channel.trigger("elements:reset",elements)},undo:function(){if(!this.length){return}var entry=this.at(this.indexOf(this.getActive())+1);if(entry){this.restore(entry.get("timestamp"))}},redo:function(){if(!this.length){return}var entry=this.at(this.indexOf(this.getActive())-1);if(entry){this.restore(entry.get("timestamp"))}},checkLength:function(){if(this.length>this.maxSize){this.pop()}},setActive:function(model){this.active=model;this.trigger("change:active",model)},getActive:function(){return this.active}});module.exports=SnapshotCollection},{}],47:[function(require,module,exports){var SearchableCollection=require("./searchable"),TemplateCollection;TemplateCollection=SearchableCollection.extend({model:require("../models/template"),comparator:"name",getHaystack:function(model){return[model.get("id"),model.get("label")].join(" ")}});module.exports=TemplateCollection},{"../models/template":55,"./searchable":43}],48:[function(require,module,exports){var ControlModel=Backbone.Model.extend({defaults:{id:"",label:"",description:"",type:"",choices:{},priority:0,setting:"",section:""}});module.exports=ControlModel},{}],49:[function(require,module,exports){var ContainerModel=Backbone.Model.extend({defaults:function(){return{label:"",description:"",tag:"",icon:"",sections:[],controls:[],type:"default",child:"",collection:"library"}},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:add:top",this.insertBefore);this.listenTo(this,"element:add:bottom",this.insertAfter);this.listenTo(this,"element:add:left",this.columnBefore);this.listenTo(this,"element:add:right",this.columnAfter)},insertBefore:function(view){this.insertAtIndex(view.model,view.model.get("order"))},insertAfter:function(view){this.insertAtIndex(view.model,view.model.get("order")+1)},insertAtIndex:function(model,index){var tag="tailor_content";var children=model.collection.create([{tag:tag,atts:{}},{tag:tag,atts:{}}],{silent:true});model.collection.createContainer(this,model.get("parent"),index,children)},columnBefore:function(view){var parentId=view.model.get("parent");var tag="tailor_content";var children;if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,view.model.get("order")-1);children=view.model.collection.create([{tag:tag,atts:{}},{tag:tag,atts:{}}],{silent:true});view.model.collection.createContainer(this,column.get("id"),0,children)}else{var columns=view.model.collection.createRow(parentId,view.model.get("order"));view.model.collection.insertChild(view.model,_.last(columns));children=view.model.collection.create([{tag:tag,atts:{}},{tag:tag,atts:{}}],{silent:true});view.model.collection.createContainer(this,_.first(columns).get("id"),0,children)}},columnAfter:function(view){var parentId=view.model.get("parent");var tag="tailor_content";var children;if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,view.model.get("order"));children=view.model.collection.create([{tag:tag,atts:{}},{tag:tag,atts:{}}],{silent:true});view.model.collection.createContainer(this,column.get("id"),0,children)}else{var columns=view.model.collection.createRow(parentId,view.model.get("order"));view.model.collection.insertChild(view.model,_.first(columns));children=view.model.collection.create([{tag:tag,atts:{}},{tag:tag,atts:{}}],{silent:true});view.model.collection.createContainer(this,_.last(columns).get("id"),0,children)}}});module.exports=ContainerModel},{}],50:[function(require,module,exports){var WrapperModel=Backbone.Model.extend({defaults:function(){return{label:"",description:"",tag:"",icon:"",sections:[],controls:[],type:"default",child:"",collection:"library"}},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:add:top",this.insertBefore);this.listenTo(this,"element:add:bottom",this.insertAfter);this.listenTo(this,"element:add:left",this.columnBefore);this.listenTo(this,"element:add:right",this.columnAfter);this.listenTo(this,"element:add:center",this.createChild)},insertBefore:function(view){this.insertAtIndex(view.model,view.model.get("order")-1)},insertAfter:function(view){this.insertAtIndex(view.model,view.model.get("order"))},insertAtIndex:function(model,index){model.collection.createWrapper(this.get("tag"),model.get("parent"),index)},columnBefore:function(view){var parentId=view.model.get("parent");var index=view.model.get("order")-1;var tag="tailor_content";if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,index);view.model.collection.createWrapper(this.get("tag"),column.get("id"),0)}else{var columns=view.model.collection.createRow(parentId,index);view.model.collection.insertChild(view.model,_.last(columns));view.model.collection.createWrapper(this.get("tag"),_.first(columns).get("id"),0)}},columnAfter:function(view){var parentId=view.model.get("parent");var index=view.model.get("order");var tag="tailor_content";if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,index);view.model.collection.createWrapper(this.get("tag"),column.get("id"),0)}else{var columns=view.model.collection.createRow(parentId,index);view.model.collection.insertChild(view.model,_.first(columns));view.model.collection.createWrapper(this.get("tag"),_.last(columns).get("id"),0)}},createChild:function(view){var parentId=view.model.get("id");var childTag=view.model.get("child");var numberChildren=view.model.collection.where({parent:parentId,tag:childTag}).length;var wrapper=view.model.collection.createWrapper(childTag,parentId,numberChildren,false);view.model.collection.createWrapper(this.get("tag"),wrapper.get("id"),0)}});module.exports=WrapperModel},{}],51:[function(require,module,exports){var ElementModel=Backbone.Model.extend({defaults:function(){return{label:"",description:"",tag:"",icon:"",sections:[],controls:[],type:"default",child:"",collection:"library"}},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:add:top",this.insertBefore);this.listenTo(this,"element:add:bottom",this.insertAfter);this.listenTo(this,"element:add:left",this.columnBefore);this.listenTo(this,"element:add:right",this.columnAfter);this.listenTo(this,"element:add:center",this.createChild)},insertBefore:function(view){this.insertAtIndex(view.model,view.model.get("order")-1)},insertAfter:function(view){this.insertAtIndex(view.model,view.model.get("order"))},insertAtIndex:function(model,index){model.collection.create([{tag:this.get("tag"),label:this.get("label"),parent:model.get("parent"),type:this.get("type"),order:index}],{})},columnBefore:function(view){var parentId=view.model.get("parent");if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,view.model.get("order")-1);view.model.collection.create([{tag:this.get("tag"),label:this.get("label"),parent:column.get("id"),type:this.get("type"),order:0}],{at:0})}else{var columns=view.model.collection.createRow(parentId,view.model.get("order"));view.model.collection.create([{tag:this.get("tag"),label:this.get("label"),parent:_.first(columns).get("id"),type:this.get("type"),order:0}],{at:0});view.model.collection.insertChild(view.model,_.last(columns))}},columnAfter:function(view){var parentId=view.model.get("parent");if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,view.model.get("order"));view.model.collection.create([{tag:this.get("tag"),label:this.get("label"),parent:column.get("id"),type:this.get("type"),order:0}],{at:0})}else{var columns=view.model.collection.createRow(parentId,view.model.get("order"));view.model.collection.create([{tag:this.get("tag"),label:this.get("label"),parent:_.last(columns).get("id"),type:this.get("type"),order:0}],{at:0});view.model.collection.insertChild(view.model,_.first(columns))}},createChild:function(view){var parentId=view.model.get("id");var childTag=view.model.get("child");var numberChildren=view.model.collection.where({parent:parentId,tag:childTag}).length;var wrapper=view.model.collection.createWrapper(childTag,parentId,numberChildren,false);var child=view.model.collection.create([{tag:this.get("tag"),label:this.get("label"),parent:wrapper.get("id"),type:this.get("type"),order:0}],{at:0})}});module.exports=ElementModel},{}],52:[function(require,module,exports){var PanelModel=Backbone.Model.extend({defaults:{id:"",title:"",description:"",collection:"",priority:0}});module.exports=PanelModel},{}],53:[function(require,module,exports){var SectionModel=Backbone.Model.extend({defaults:{id:"",title:"",description:"",priority:0,panel:""}});module.exports=SectionModel},{}],54:[function(require,module,exports){var SettingModel=Backbone.Model.extend({defaults:{id:"",type:""}});module.exports=SettingModel},{}],55:[function(require,module,exports){var TemplateModel=Backbone.Model.extend({defaults:function(){return{id:this.cid,label:"",collection:"template"}},initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this,"element:add:top",this.insertBefore);this.listenTo(this,"element:add:bottom",this.insertAfter);this.listenTo(this,"element:add:left",this.columnBefore);this.listenTo(this,"element:add:right",this.columnAfter);this.listenTo(this,"element:add:center",this.createChild)},createChild:function(view){var parentId=view.model.get("id");var childTag=view.model.get("child");var numberChildren=view.model.collection.where({parent:parentId,tag:childTag}).length;var wrapper=view.model.collection.createWrapper(childTag,parentId,numberChildren,false);app.channel.trigger("template:load",this,wrapper.get("id"),0)},columnBefore:function(view){var parentId=view.model.get("parent");if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,view.model.get("order")-1);app.channel.trigger("template:load",this,column.get("id"),0)}else{var columns=view.model.collection.createRow(parentId,view.model.get("order"));app.channel.trigger("template:load",this,_.first(columns).get("id"),0);view.model.collection.insertChild(view.model,_.last(columns))}},columnAfter:function(view){var parentId=view.model.get("parent");if("tailor_column"==view.model.get("tag")){var column=view.model.collection.createColumn(parentId,view.model.get("order"));app.channel.trigger("template:load",this,column.get("id"),0)}else{var columns=view.model.collection.createRow(parentId,view.model.get("order"));app.channel.trigger("template:load",this,_.last(columns).get("id"),0);view.model.collection.insertChild(view.model,_.first(columns))}},insertBefore:function(view){app.channel.trigger("template:load",this,view.model.get("parent"),view.model.get("order")-1)},insertAfter:function(view){app.channel.trigger("template:load",this,view.model.get("parent"),view.model.get("order"))}});module.exports=TemplateModel},{}],56:[function(require,module,exports){var $=window.jQuery,DevicePreviewModule;DevicePreviewModule=Marionette.Module.extend({device:"desktop",onBeforeStart:function(){var module=this;var api={getDevice:function(){return module.device}};app.channel.reply("sidebar:device",api.getDevice)},onStart:function(){var module=this;this.$buttons=$(".tailor-sidebar .devices button");this.preview=document.querySelector(".tailor-preview");this.viewport=this.preview.querySelector(".tailor-preview__viewport");this.mediaQueries=window._media_queries;this.setActive(this.$buttons.get(0));this.addEventListeners();app.channel.trigger("module:devicePreview:ready",this)},addEventListeners:function(){this.$buttons.on("click",this.onDevicePreview.bind(this))},onDevicePreview:function(e){var button=e.target;var previous=this.$buttons.filter("[data-device='"+this.device+"']").get(0);this.setInactive(previous);this.setActive(button);this.device=button.getAttribute("data-device");this.preview.className="tailor-preview "+this.device+"-screens";if(this.mediaQueries.hasOwnProperty(this.device)&&this.mediaQueries[this.device].max){this.viewport.style.maxWidth=this.mediaQueries[this.device].max}else{this.viewport.style.maxWidth=""}},setActive:function(button){button.classList.add("is-active");button.setAttribute("aria-pressed","true")},setInactive:function(button){button.classList.remove("is-active");button.setAttribute("aria-pressed","false")}});module.exports=DevicePreviewModule},{}],57:[function(require,module,exports){var DialogRegion=Backbone.Marionette.Region.extend({initialize:function(){this.$overlay=jQuery('
    ')},onShow:function(view,region,options){this.el.classList.add("is-visible");this.$overlay.on("click",jQuery.proxy(this.empty,this)).appendTo("body")},onEmpty:function(view,region,options){this.el.classList.remove("is-visible");this.$overlay.off().detach()}});module.exports=DialogRegion},{}],58:[function(require,module,exports){var DialogView=require("./show/dialog"),DialogModule;DialogModule=Marionette.Module.extend({onStart:function(){var api={showDialog:function(options){app.dialog.show(new DialogView(options))}};this.listenTo(app.channel,"dialog:open",api.showDialog);app.channel.trigger("module:dialog:ready",this)}});module.exports=DialogModule},{"./show/dialog":59}],59:[function(require,module,exports){var $=window.jQuery,DialogView;DialogView=Backbone.Marionette.ItemView.extend({className:"dialog",defaults:{title:"",content:"",button:""},ui:{close:".js-close",content:".dialog__content",save:".js-save"},events:{input:"onChange",change:"onChange"},triggers:{"click @ui.close":"close","click @ui.save":"save"},template:"#tmpl-tailor-dialog",serializeData:function(){return{title:this.title,content:this.content,button:this.button}},initialize:function(options){this.title=options.title||this.defaults.title;this.content=options.content||this.defaults.content;this.button=options.button||this.defaults.button;this.callbacks={validate:options.onValidate,open:options.onOpen,save:options.onSave,close:options.onClose}},onBeforeRender:function(){if("function"==typeof this.content){this.content=this.content.call(this)}},onDomRefresh:function(){if("function"===typeof this.callbacks.open){this.callbacks.open.call(this)}this.validate()},onChange:function(){this.validate()},validate:function(){if("function"===typeof this.callbacks.validate){this.ui.save.prop("disabled",!this.callbacks.validate.call(this))}},onSave:function(){if("function"===typeof this.callbacks.save){this.callbacks.save.call(this)}this.onClose()},onClose:function(){if("function"===typeof this.callbacks.close){this.callbacks.close.call(this)}this.triggerMethod("destroy")}});module.exports=DialogView},{}],60:[function(require,module,exports){var SnapshotsCollection=require("../../entities/collections/snapshots"),SnapshotMenuItem=require("./show/snapshot-menu-item"),HistoryModule;Tailor.Items.History=SnapshotMenuItem;HistoryModule=Marionette.Module.extend({onBeforeStart:function(){var module=this;module.collection=new SnapshotsCollection;var api={getSnapshot:function(id){if(id){return module.collection.findWhere({id:id})}return module.collection}};app.channel.reply("sidebar:history",api.getSnapshot)},onStart:function(options){this.l10n=options.l10n;this.addEventListeners();app.channel.trigger("module:history:ready",this)},addEventListeners:function(){this.listenTo(app.channel,"element:add",this.onAddElement);this.listenTo(app.channel,"element:copy",this.onCopyElement);this.listenTo(app.channel,"element:move",this.onMoveElement);this.listenTo(app.channel,"modal:apply",this.onEditElement);this.listenTo(app.channel,"element:delete",this.onDeleteElement);this.listenTo(app.channel,"element:resize",this.onResizeElement);this.listenTo(app.channel,"navigation:reorder",this.onReorderElement);this.listenTo(app.channel,"template:add",this.onAddTemplate);this.listenTo(app.channel,"history:restore",this.restoreSnapshot);this.listenTo(app.channel,"history:undo",this.undoStep);this.listenTo(app.channel,"history:redo",this.redoStep)},onAddElement:function(model){if("library"==model.get("collection")){this.saveSnapshot(this.l10n.added+" "+model.get("label"))}},onEditElement:function(modal,model){this.saveSnapshot(this.l10n.edited+" "+model.get("label"))},onCopyElement:function(model){this.saveSnapshot(this.l10n.copied+" "+model.get("label"))},onMoveElement:function(model){this.saveSnapshot(this.l10n.moved+" "+model.get("label"))},onDeleteElement:function(model){this.saveSnapshot(this.l10n.deleted+" "+model.get("label"))},onResizeElement:function(model){this.saveSnapshot(this.l10n.resized+" "+model.get("label"))},onReorderElement:function(model){this.saveSnapshot(this.l10n.reordered+" "+model.get("label"))},onAddTemplate:function(model){this.saveSnapshot(this.l10n.added+" "+this.l10n.template+" - "+model.get("label"))},saveSnapshot:function(label){this.collection.save(label)},restoreSnapshot:function(timestamp){this.collection.restore(timestamp)},undoStep:function(){this.collection.undo()},redoStep:function(){this.collection.redo()}});module.exports=HistoryModule},{"../../entities/collections/snapshots":46,"./show/snapshot-menu-item":61}],61:[function(require,module,exports){var $=Backbone.$,HistoryItem;HistoryItem=Marionette.ItemView.extend({events:{click:"restore",keypress:"onKeyPress"},template:"#tmpl-tailor-panel-history-item",initialize:function(){this.addEventListeners()},addEventListeners:function(){this.listenTo(this.model.collection,"change:active",this.toggleClass)},onRender:function(){this.toggleClass()},attachElContent:function(html){var $el=$(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("tabindex",0);return this},onKeyPress:function(e){if(13===e.which){this.restore()}},restore:function(){var timestamp=this.model.get("timestamp");app.channel.trigger("before:history:restore",timestamp);app.channel.trigger("history:restore",timestamp)},toggleClass:function(model){model=model||this.model.collection.getActive();this.$el.toggleClass("is-active",model===this.model)}});module.exports=HistoryItem},{}],62:[function(require,module,exports){var LibraryCollection=require("../../entities/collections/library"),LibraryMenuItem=require("./show/library-menu-item"),LibraryModule;Tailor.Items.Library=LibraryMenuItem;LibraryModule=Marionette.Module.extend({onBeforeStart:function(options){var collection=new LibraryCollection(options.library);var api={getLibraryItem:function(tag){if(tag){return collection.findWhere({tag:tag})}return collection}};app.channel.reply("sidebar:library",api.getLibraryItem)},onStart:function(){app.channel.trigger("module:library:ready",this)}});module.exports=LibraryModule},{"../../entities/collections/library":41,"./show/library-menu-item":63}],63:[function(require,module,exports){var $=Backbone.$,ElementMenuItem;ElementMenuItem=Marionette.ItemView.extend({events:{click:"onClick",keypress:"onKeyPress"},modelEvents:{"change:match":"onSearch"},behaviors:{Draggable:{}},onClick:function(){var el=this.el;if(el.classList.contains("is-inactive")){return}var onAnimationEnd=function(e){el.removeEventListener(window.animationEndName,onAnimationEnd);el.classList.remove("shake")};if(Modernizr.cssanimations){el.addEventListener(window.animationEndName,onAnimationEnd);el.classList.add("shake")} +Tailor.Notify(window._l10n.dragElement,"warning")},getTemplate:function(){return"#tmpl-tailor-panel-library-item"},attachElContent:function(html){var $el=$(html);this.$el.replaceWith($el);this.setElement($el);return this},onSearch:function(model){this.el.style.display=!model.get("match")?"none":"block"}});module.exports=ElementMenuItem},{}],64:[function(require,module,exports){var ModalRegion=Backbone.Marionette.Region.extend({onShow:function(view,region,options){this.el.classList.add("is-visible");var rect=this.el.getBoundingClientRect();var width=this.el.style.width?this.el.style.width:rect.width;this.el.style.width=width+"px";if(!this.el.style.height){this.el.style.height=window.innerHeight-40+"px"}if(!this.el.style.top){this.el.style.top="20px"}if(!this.el.style.left){if(document.documentElement.dir&&"rtl"==document.documentElement.dir){this.el.style.left=20+"px"}else{this.el.style.left=window.innerWidth-(rect.width+20)+"px"}}this.updateClassName(width);this.listenTo(view,"modal:resize",this.onResize)},onResize:function(width,height){this.updateClassName(width)},updateClassName:function(width){this.$el.toggleClass("is-x-small",width<480).toggleClass("is-small",481=1200)},onEmpty:function(view,region,options){this.el.classList.remove("is-visible");this.stopListening(view,"modal:resize",this.onResize)}});module.exports=ModalRegion},{}],65:[function(require,module,exports){var ModalView=require("./show/modal"),ModalModule;ModalModule=Marionette.Module.extend({onStart:function(){var api={openModal:function(model){if(app.modal.hasView()){if(model===app.modal.currentView.model){return}app.modal.currentView.triggerMethod("close")}app.modal.show(new ModalView({model:model}))},closeModal:function(){app.modal.empty()}};this.listenTo(app.channel,"modal:open",api.openModal);this.listenTo(app.channel,"elements:reset",api.closeModal);app.channel.trigger("module:modal:ready",this)}});module.exports=ModalModule},{"./show/modal":68}],66:[function(require,module,exports){var EmptyModalView=Marionette.ItemView.extend({className:"empty",template:"#tmpl-tailor-modal-empty"});module.exports=EmptyModalView},{}],67:[function(require,module,exports){var EmptySectionView=Marionette.ItemView.extend({className:"empty",template:"#tmpl-tailor-section-default-empty"});module.exports=EmptySectionView},{}],68:[function(require,module,exports){var SectionCollectionView=require("./sections"),NavigationView=require("./tabs"),ModalView;ModalView=Marionette.LayoutView.extend({className:"modal",ui:{close:".js-close",apply:".js-apply"},behaviors:{Resizable:{ui:{handle:".modal__title"}}},triggers:{"click @ui.close":"close","click @ui.apply":"apply"},modelEvents:{destroy:"destroy"},template:"#tmpl-tailor-modal",regions:{tabs:"#tailor-modal-tabs",sections:"#tailor-modal-sections"},initialize:function(){this.isModified=false;this.settings=app.channel.request("sidebar:settings",this.model);this.addEventListeners();app.channel.trigger("modal:initialize",this,this.model)},addEventListeners:function(){this.listenTo(this.settings,"change",this.onChange)},onRender:function(){var model=this.model;var sections=app.channel.request("sidebar:sections",model);var controls=app.channel.request("sidebar:controls",model);this.showChildView("sections",new SectionCollectionView({element:model,collection:sections,controls:controls}));if(sections.length>1){this.showChildView("tabs",new NavigationView({collection:sections}));this.el.classList.add("has-sections")}model.collection.trigger("edit",model,true)},onShow:function(){this.ui.close.focus()},onChange:function(setting){this.isModified=true;this.ui.apply.attr("disabled",false);var model=this.model;if(!model.isTracking()){model.startTracking()}var update=setting.get("refresh");var jsRefresh=update.hasOwnProperty("method")&&"js"==update["method"];if(jsRefresh&&update.hasOwnProperty("dependencies")){for(var settingId in update["dependencies"]){if(update["dependencies"].hasOwnProperty(settingId)&&_.has(update["dependencies"][settingId],"condition")&&_.has(update["dependencies"][settingId],"value")){var targetSetting=setting.collection.get(settingId);if(targetSetting&&!Tailor.Helpers.checkCondition(update["dependencies"][settingId]["condition"],targetSetting.get("value"),update["dependencies"][settingId]["value"])){jsRefresh=false;break}}}}model.set("atts",this.atts(),{silent:jsRefresh});if(jsRefresh){model.trigger("change:setting",setting,model)}app.channel.trigger("canvas:reset")},onApply:function(){this.model.stopTracking();this.model.set("atts",this.atts());app.channel.trigger("modal:apply",this,this.model);this.triggerMethod("destroy")},onClose:function(){if(this.isModified){var applyChanges=confirm(window._l10n.confirmElement);if(true===applyChanges){this.triggerMethod("apply")}else{this.model.resetAttributes()}}app.channel.trigger("modal:close",this);this.triggerMethod("destroy")},onDestroy:function(){this.model.collection.trigger("edit",this.model,false);app.channel.trigger("modal:destroy",this,this.model)},atts:function(){var atts={};this.settings.each(function(setting){var value=setting.get("value");if(null!==value){atts[setting.get("id")]=value}},this);return atts}});module.exports=ModalView},{"./sections":70,"./tabs":72}],69:[function(require,module,exports){var ControlCollectionView=Marionette.CollectionView.extend({tagName:"ul",className:"controls controls--modal",emptyView:require("./empty-section"),getChildView:function(child){return Tailor.lookup(child.get("type"),false,"Controls")},childViewOptions:function(model,index){var options={model:model};if("list"===model.get("type")){options.element=this.element;options.collection=this.element.collection}return options},filter:function(child,index,collection){return child.get("section")===this.model.get("id")},initialize:function(options){this.model=options.model;this.element=options.element;this.addEventListeners()},addEventListeners:function(){this.listenTo(this.model.collection,"select",this.onSelect)},onSelect:function(model){this.$el.toggle(model===this.model)}});module.exports=ControlCollectionView},{"./empty-section":67}],70:[function(require,module,exports){var SectionCollectionView=Marionette.CollectionView.extend({childView:require("./section"),emptyView:require("./empty-modal"),childViewOptions:function(model,index){return{model:model,element:this.element,collection:this.controls}},initialize:function(options){this.element=options.element;this.controls=options.controls}});module.exports=SectionCollectionView},{"./empty-modal":66,"./section":69}],71:[function(require,module,exports){var NavigationItemView=Marionette.ItemView.extend({tagName:"li",className:"tab",attributes:{tabindex:0},events:{click:"select",keypress:"onKeyPress"},template:"#tmpl-tailor-modal-item",select:function(){this.triggerMethod("select")},onSelect:function(){this.model.trigger("select",this.model);this.el.focus()},onKeyPress:function(e){if(13===e.which){this.select()}}});module.exports=NavigationItemView},{}],72:[function(require,module,exports){var NavigationItemView=require("./tab"),NavigationView;NavigationView=Marionette.CollectionView.extend({tagName:"ul",className:"tabs",childView:NavigationItemView,childEvents:{select:"onSelect"},onRender:function(){if(this.collection.length>0){this.children.first().triggerMethod("select")}},onSelect:function(view){this.children.each(function(child){child.$el.toggleClass("is-active",view===child)})}});module.exports=NavigationView},{"./tab":71}],73:[function(require,module,exports){var Notify=window.Tailor.Notify,NotificationsModule;NotificationsModule=Marionette.Module.extend({onStart:function(){this.addEventListeners();app.channel.trigger("module:notifications:ready",this)},addEventListeners:function(){var l10n=window._l10n;this.listenTo(app.channel,"sidebar:save",function(){Notify(l10n.savedPage,"success")});this.listenTo(app.channel,"elements:restore",function(){Notify(l10n.restoreElements,"success")});this.listenTo(app.channel,"element:delete",function(){Notify(l10n.deletedElement,"success")});this.listenTo(app.channel,"template:save",function(){Notify(l10n.savedTemplate,"success")});this.listenTo(app.channel,"template:import",function(){Notify(l10n.importedTemplate,"success")});this.listenTo(app.channel,"template:add",function(){Notify(l10n.addedTemplate,"success")});this.listenTo(app.channel,"template:delete",function(){Notify(l10n.deletedTemplate,"success")})}});module.exports=NotificationsModule},{}],74:[function(require,module,exports){var PanelCollection=require("../../entities/collections/panels"),PanelLayoutView=require("./show/layout"),PanelMenuItem=require("./show/panel-menu-item"),PanelsModule;Tailor.Items.Panels=PanelMenuItem;PanelsModule=Marionette.Module.extend({onBeforeStart:function(options){var module=this;module.collection=new PanelCollection(options.panels);var api={getPanels:function(id){if(id){return module.collection.findWhere({id:id})}return module.collection}};app.channel.reply("sidebar:panels",api.getPanels)},onStart:function(){app.content.show(new PanelLayoutView({panels:app.channel.request("sidebar:panels"),sections:app.channel.request("sidebar:sections"),controls:app.channel.request("sidebar:controls"),settings:app.channel.request("sidebar:settings")}));app.channel.trigger("module:panels:ready",this)}});module.exports=PanelsModule},{"../../entities/collections/panels":42,"./show/layout":75,"./show/panel-menu-item":76}],75:[function(require,module,exports){var PanelsView=require("./panels"),PanelLayoutView;PanelLayoutView=Marionette.LayoutView.extend({ui:{pageTitle:".back-button"},className:"tailor-sidebar__layout",regions:{panels:"#tailor-sidebar-home",panel:"#tailor-sidebar-panel",section:"#tailor-sidebar-section"},childEvents:{"show:panel":"showPanel","show:section":"showSection","back:home":"displayHome","back:panel":"displayPanel"},template:function(){return document.getElementById("tmpl-tailor-sidebar-layout").innerHTML},initialize:function(options){this.panels=options.panels;this.sections=options.sections;this.controls=options.controls;this.settings=options.settings},onRender:function(){this.showChildView("panels",new PanelsView({collection:this.panels}))},showPanel:function(view){this.displayPanel();var collection=app.channel.request("sidebar:"+view.model.get("type"));var PanelView=Tailor.lookup(view.model.get("type"),false,"Panels");this.showChildView("panel",new PanelView({model:view.model,collection:collection}))},showSection:function(view){this.el.classList.add("section-visible");this.el.classList.remove("panel-visible");var SectionView=Tailor.lookup(view.model.get("type"),false,"Sections");this.showChildView("section",new SectionView({model:view.model,collection:this.controls,panel:this.panels.findWhere({id:view.model.get("panel")})}))},displayHome:function(view){this.el.classList.remove("panel-visible");this.el.classList.remove("section-visible");if(view){view.model.trigger("focus")}},displayPanel:function(view){this.el.classList.remove("section-visible");this.el.classList.add("panel-visible");if(view){view.model.trigger("focus")}}});module.exports=PanelLayoutView},{"./panels":78}],76:[function(require,module,exports){var $=Backbone.$,PanelItem;PanelItem=Marionette.ItemView.extend({events:{click:"onClick",keypress:"onKeyPress"},modelEvents:{focus:"onFocus"},template:"#tmpl-tailor-panel-default-item",attachElContent:function(html){var $el=$(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("tabindex",0);return this},onClick:function(){this.triggerMethod("show:panel")},onKeyPress:function(e){if(13===e.which){this.triggerMethod("show:panel")}},onFocus:function(){this.el.focus()}});module.exports=PanelItem},{}],77:[function(require,module,exports){var EmptyPanelView=Marionette.ItemView.extend({className:"empty",template:"#tmpl-tailor-home-empty"});module.exports=EmptyPanelView},{}],78:[function(require,module,exports){var PanelsView=Marionette.CompositeView.extend({getChildView:function(){return Tailor.lookup("panels",false,"Items")},childViewContainer:"#items",emptyView:require("./panels-empty"),behaviors:{Panel:{}},template:"#tmpl-tailor-home"});module.exports=PanelsView},{"./panels-empty":77}],79:[function(require,module,exports){var SectionCollection=require("../../entities/collections/sections"),DefaultMenuItem=require("./show/default-menu-item"),SectionsModule;Tailor.Items.Default=DefaultMenuItem;SectionsModule=Marionette.Module.extend({onBeforeStart:function(options){var module=this;module.collection={sidebar:new SectionCollection(options.sections)};var api={getSections:function(model){if(!model){return module.collection["sidebar"]}var cid=model.cid;if(!module.collection.hasOwnProperty(cid)){var itemDefinition=app.channel.request("sidebar:library",model.get("tag"));var sections=itemDefinition.get("sections")||[];module.collection[cid]=new SectionCollection(sections)}return module.collection[cid]}};app.channel.reply("sidebar:sections sidebar:default",api.getSections)},onStart:function(){app.channel.trigger("module:sections:ready",this)}});module.exports=SectionsModule},{"../../entities/collections/sections":44,"./show/default-menu-item":80}],80:[function(require,module,exports){var $=Backbone.$,DefaultItem;DefaultItem=Marionette.ItemView.extend({events:{click:"onClick",keypress:"onKeyPress"},modelEvents:{focus:"onFocus"},template:"#tmpl-tailor-panel-default-item",attachElContent:function(html){var $el=$(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("tabindex",0);return this},onClick:function(){this.triggerMethod("show:section")},onKeyPress:function(e){if(13===e.which){this.triggerMethod("show:section")}},onFocus:function(){this.el.focus()}});module.exports=DefaultItem},{}],81:[function(require,module,exports){var SettingCollection=require("../../entities/collections/settings"),ControlCollection=require("../../entities/collections/controls"),SettingsModule;SettingsModule=Marionette.Module.extend({onBeforeStart:function(options){var module=this;module.settings={sidebar:new SettingCollection(options.settings)};module.controls={sidebar:new ControlCollection(options.controls,{silent:false,settings:module.settings["sidebar"]})};var api={getControls:function(model){if(!model){return module.controls["sidebar"]}var cid=model.cid;if(!module.controls.hasOwnProperty(cid)){var itemDefinition=app.channel.request("sidebar:library",model.get("tag"));var controls=itemDefinition.get("controls")||[];var settings=api.getSettings(model);module.controls[cid]=new ControlCollection(controls,{silent:false,settings:settings})}return module.controls[cid]},getSettings:function(model){if(!model){return module.settings["sidebar"]}var cid=model.cid;if(!module.settings.hasOwnProperty(cid)){var itemDefinition=app.channel.request("sidebar:library",model.get("tag"));var settings=itemDefinition.get("settings")||[];module.settings[cid]=new SettingCollection(settings,{element:model})}module.settings[cid].load();return module.settings[cid]}};app.channel.reply("sidebar:controls",api.getControls);app.channel.reply("sidebar:settings",api.getSettings);this.listenTo(module.settings["sidebar"],"change",this.onChangeSetting)},onStart:function(){app.channel.trigger("module:settings:ready",this)},onChangeSetting:function(setting){app.channel.trigger("sidebar:setting:change",setting)}});module.exports=SettingsModule},{"../../entities/collections/controls":40,"../../entities/collections/settings":45}],82:[function(require,module,exports){var $=Backbone.$,l10n=window._l10n,TemplateMenuItem;TemplateMenuItem=Marionette.ItemView.extend({ui:{delete:".js-delete-template",download:".js-download-template",preview:".js-preview-template"},events:{click:"onClick"},modelEvents:{"change:match":"onSearch"},behaviors:{Draggable:{}},onClick:function(e){switch(e.target){case this.ui.download.get(0):this.download();break;case this.ui.delete.get(0):this.delete();break;case this.ui.preview.get(0):this.preview();break;default:var el=this.el;var onAnimationEnd=function(e){el.removeEventListener(window.animationEndName,onAnimationEnd);el.classList.remove("shake")};if(Modernizr.cssanimations){el.addEventListener(window.animationEndName,onAnimationEnd);el.classList.add("shake")}Tailor.Notify(l10n.dragTemplate,"warning")}},getTemplate:function(){return"#tmpl-tailor-panel-templates-item"},attachElContent:function(html){var $el=$(html);this.$el.replaceWith($el);this.setElement($el);this.el.setAttribute("tabindex",0);return this},download:function(){var item=this;var id=item.model.get("id");window.ajax.send("tailor_load_template",{data:{template_id:id,nonce:window._nonces.loadTemplate},success:function(response){var model=item.model;var models=response.models;var label=model.get("label");id=label.replace(" ","-").toLowerCase();var json={id:id,label:label,tag:model.get("tag"),type:model.get("type"),models:models};json="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(json));var a=document.getElementById("download-template");a.setAttribute("href",json);a.setAttribute("download","tailor-template-"+id+"-"+Date.now()+".json");a.click();app.channel.trigger("template:download")}})},delete:function(){var that=this;window.ajax.send("tailor_delete_template",{data:{id:that.model.get("id"),nonce:window._nonces.deleteTemplate},success:function(){that.$el.slideUp(function(){that.model.trigger("destroy",that.model)});app.channel.trigger("template:delete")}})},preview:function(){window._urls.view+=(window._urls.view.split("?")[1]?"&":"?")+"template_preview=1&template_id="+this.model.get("id");window.open(window._urls.view,"_blank");app.channel.trigger("template:preview")},onSearch:function(model){this.el.style.display=!model.get("match")?"none":"block"}});module.exports=TemplateMenuItem},{}],83:[function(require,module,exports){var l10n=window._l10n,TemplatesPanel;TemplatesPanel=Marionette.CompositeView.extend({ui:{backButton:".back-button",save:".js-save-template",import:".js-import-template",searchForm:".search-form"},events:{"click @ui.save":"save","click @ui.import":"import"},triggers:{"click @ui.backButton":"back:home"},behaviors:{Panel:{}},emptyView:Tailor.Panels.Empty,emptyViewOptions:function(){return{type:this.model.get("type")}},template:"#tmpl-tailor-panel-templates",childViewContainer:"#items",getChildView:function(){return Tailor.lookup(this.model.get("type"),false,"Items")},serializeData:function(){var data=Marionette.ItemView.prototype.serializeData.apply(this,arguments);data.items=this.collection;return data},onShow:function(){this.ui.backButton.get(0).focus();if(0===this.collection.length){this.ui.searchForm.hide()}},onAddChild:function(){this.ui.searchForm.show()},onRemoveChild:function(){if(0===this.collection.length){this.ui.searchForm.hide()}},import:function(e){var panel=this;var options={title:l10n.importTemplate,content:document.querySelector("#tmpl-tailor-dialog-import-template").innerHTML,button:l10n.import,onOpen:function(){this.el.querySelector("#import-template").focus()},onValidate:function(){var input=this.el.querySelector("#import-template");var re=/(?:\.([^.]+))?$/;return input.value&&"json"===re.exec(input.value)[1]},onSave:function(){var input=this.el.querySelector("#import-template");var file=input.files[0];if(!file||file.name.match(/.+\.json/)){var reader=new FileReader;reader.onload=function(e){var defaults={label:"",tag:"",models:[],nonce:window._nonces.saveTemplate};var data=_.extend(defaults,JSON.parse(reader.result));data.models=JSON.stringify(data.models);panel.createTemplate(data,"import")};try{reader.readAsText(file)}catch(e){}}},onClose:function(){panel.ui.import.focus()}};app.channel.trigger("dialog:open",options)},save:function(){var selected=app.channel.request("canvas:element:selected");var elements=app.channel.request("canvas:elements");var models=[];var tag;if(selected&&"function"==typeof selected.get){var getChildren=function(id){_.each(elements.where({parent:id}),function(model){models.push(model.toJSON());getChildren(model.get("id"))})};if("child"==selected.get("type")){selected=selected.collection.get(selected.get("parent"))}getChildren(selected.get("id"));selected=selected.toJSON();selected.parent="";models.push(selected);tag=selected.tag}else{models=elements.models;tag="tailor_section"}var panel=this;app.channel.trigger("dialog:open",{title:l10n.saveTemplate,content:document.querySelector("#tmpl-tailor-dialog-save-template").innerHTML,button:l10n.save,onOpen:function(){this.el.querySelector("#save-template").focus()},onValidate:function(){var input=this.el.querySelector("#save-template");return input.value.trim()},onSave:function(){var input=this.el.querySelector("#save-template");var data={label:input.value,tag:tag,models:JSON.stringify(models),nonce:window._nonces.saveTemplate};panel.createTemplate(data,"save")},onClose:function(){panel.ui.save.focus()}})},createTemplate:function(data,action){action=action||"save";var panel=this;var collection=panel.collection;panel.ui.save.prop("disabled",true);panel.ui.import.prop("disabled",true);window.ajax.send("tailor_save_template",{data:data,success:function(response){collection.add({id:response.id,label:response.label,tag:response.tag,type:response.type});app.channel.trigger("template:"+action)},complete:function(){panel.ui.save.prop("disabled",false);panel.ui.import.prop("disabled",false)}})}});module.exports=TemplatesPanel},{}],84:[function(require,module,exports){var TemplateCollection=require("../../entities/collections/templates"),TemplatesPanel=require("./show/templates-panel"),TemplateItem=require("./show/template-menu-item"),TemplatesModule;Tailor.Panels.Templates=TemplatesPanel;Tailor.Items.Templates=TemplateItem;TemplatesModule=Marionette.Module.extend({onBeforeStart:function(options){var module=this;this.collection=new TemplateCollection(options.templates);var api={getTemplates:function(){return module.collection}};app.channel.reply("sidebar:templates",api.getTemplates)},onStart:function(){app.channel.trigger("module:templates:ready",this)}});module.exports=TemplatesModule},{"../../entities/collections/templates":47,"./show/template-menu-item":82,"./show/templates-panel":83}],85:[function(require,module,exports){var $=jQuery;var title=document.querySelector(".tailor__home .title");Tailor.Api.Setting.onChange("sidebar:_post_title",function(to,from){if(title.hasChildNodes()){var children=title.childNodes;for(var i=1;i Date: Wed, 12 Apr 2017 14:38:49 -0500 Subject: [PATCH 8/8] Don't need the jquery-ui-tabs module if i couldn't get it to work --- tailor.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tailor.php b/tailor.php index 67daf1f..d9ab4ff 100644 --- a/tailor.php +++ b/tailor.php @@ -403,8 +403,7 @@ public function enqueue_frontend_scripts() { if ( apply_filters( 'tailor_enable_frontend_scripts', true ) ) { // Enqueue script dependencies - wp_enqueue_script( 'jquery-ui-tabs' ); - wp_enqueue_script( 'jquery-ui-accordion'); + wp_enqueue_script( 'jquery-ui-accordion'); wp_enqueue_script( 'slick-slider' ); wp_enqueue_script( 'shuffle' ); wp_enqueue_script( 'magnific-popup' );