From 37ab661ff7190d89887ef17280328375be2ce1d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karol=20Orze=C5=82?= Date: Tue, 21 Nov 2023 18:32:36 +0100 Subject: [PATCH] Mobile Menu fix #3198 --- CHANGELOG.md | 5 + assets/common/application/offcanvas/index.js | 26 +- assets/common/js/main.js | 5106 +- platforms/common/js/main.js | 41075 ++++++++++++++++- 4 files changed, 46197 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68c893f07..9679267f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 5.5.18 +## 11/21/2023 +1. [Common](#common) + 1. [](#bugfix) + - Regression: Mobile Menu fix (#3198) # 5.5.17 ## 10/30/2023 1. [Common](#common) diff --git a/assets/common/application/offcanvas/index.js b/assets/common/application/offcanvas/index.js index e2bc270b1..76ca6e2e7 100644 --- a/assets/common/application/offcanvas/index.js +++ b/assets/common/application/offcanvas/index.js @@ -125,12 +125,15 @@ var Offcanvas = new prime({ return this; }, - attachMutationEvent: function() { - if (this.offcanvas instanceof Node) { - var observer = new MutationObserver(this.bound('_checkTogglers')); - observer.observe(this.offcanvas, { childList: true, subtree: true }); - } - }, + attachMutationEvent: function () { + this.observer = new MutationObserver(() => { + this._checkTogglers(); + }); + this.observer.observe(this.offcanvas[0], { + childList: true, + subtree: true, + }); + }, attachTouchEvents: function() { var msPointerSupported = window.navigator.msPointerEnabled, @@ -166,13 +169,10 @@ var Offcanvas = new prime({ return this; }, - detachMutationEvent: function() { - if (this.offcanvas instanceof Node) { - var observer = new MutationObserver(this.bound('_checkTogglers')); - observer.disconnect(); - } - }, - + detachMutationEvent: function () { + this.observer.disconnect(); + }, + detachTouchEvents: function() { var msPointerSupported = window.navigator.msPointerEnabled, touch = { diff --git a/assets/common/js/main.js b/assets/common/js/main.js index c0c323c2d..7862b8778 100644 --- a/assets/common/js/main.js +++ b/assets/common/js/main.js @@ -1 +1,5105 @@ -!function i(r,o,s){function a(e,t){if(!o[e]){if(!r[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(u)return u(e,!0);throw(n=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",n}n=o[e]={exports:{}},r[e][0].call(n.exports,function(t){return a(r[e][1][t]||t)},n,n.exports,i,r,o,s)}return o[e].exports}for(var u="function"==typeof require&&require,t=0;t ul > li",parent:".g-parent",item:".g-menu-item",dropdown:".g-dropdown",overlay:".g-menu-overlay",touchIndicator:".g-menu-parent-indicator",linkedParent:"[data-g-menuparent]",mobileTarget:"[data-g-mobile-target]"},states:{active:"g-active",inactive:"g-inactive",selected:"g-selected",touchEvents:"g-menu-hastouch"}},constructor:function(t){this.setOptions(t),this.selectors=this.options.selectors,this.states=this.options.states,this.overlay=n("div"+this.selectors.overlay),this.active=null,this.location=[];var e=f("#g-page-surround");e&&this.overlay.top(e);t=f(this.selectors.mainContainer);t&&(e=t.data("g-hover-expand"),this.hoverExpand=null===e||"true"===e,!r&&this.hoverExpand||t.addClass(this.states.touchEvents),this.attach())},attach:function(){var t=this.selectors,e=f(t.mainContainer+" "+t.item),n=f(t.mobileContainer),i=f("body");e&&(this.hoverExpand&&(e.on("mouseenter",this.bound("mouseenter")),e.on("mouseleave",this.bound("mouseleave"))),i.delegate("click",":not("+t.mainContainer+") "+t.linkedParent+", .g-fullwidth .g-sublevel "+t.linkedParent,this.bound("click")),i.delegate("click",":not("+t.mainContainer+") a[href]",this.bound("resetAfterClick")),!r&&this.hoverExpand||((t=f(t.linkedParent))&&(t.on("touchmove",this.bound("touchmove")),t.on("touchend",this.bound("touchend"))),this.overlay.on("touchend",this.bound("closeAllDropdowns"))),n&&(n="only all and (max-width: "+this._calculateBreakpoint(n.data("g-menu-breakpoint")||"48rem")+")",(n=matchMedia(n)).addListener(this.bound("_checkQuery")),this._checkQuery(n)))},detach:function(){},click:function(t){this.touchend(t)},resetAfterClick:function(t){if(null!==f(t.target).data("g-menuparent"))return!0;this.closeDropdown(t),o.G5&&o.G5.offcanvas&&G5.offcanvas.close()},mouseenter:function(t){t=f(t.target);t.parent(this.options.selectors.mainContainer)&&(t.parent(this.options.selectors.item)&&!t.parent(".g-standard")||this.openDropdown(t))},mouseleave:function(t){t=f(t.target);t.parent(this.options.selectors.mainContainer)&&(t.parent(this.options.selectors.item)&&!t.parent(".g-standard")||this.closeDropdown(t))},touchmove:function(t){f(t.target).isMoving=!0},touchend:function(t){var e,n,i,r,o=this.selectors,s=this.states,a=f(t.target),u=a.parent(o.item).find(o.touchIndicator),c=a.parent(".g-standard")?"standard":"megamenu",l=a.parent(".g-go-back");return a.isMoving?a.isMoving=!1:(a.off("touchmove",this.bound("touchmove")),a.isMoving=!1,n=(e=(a=u?u:a).matches(o.item)?a:a.parent(o.item)).hasClass(s.selected),!e.find(o.dropdown)&&!u||(t.stopPropagation(),u&&!a.matches(o.touchIndicator)||t.preventDefault(),n||(i=e.siblings())&&(i.search(o.touchIndicator+" !> * !> "+o.item+"."+s.selected)||[]).forEach(h(function(t){this.closeDropdown(t)},this)),"megamenu"!=c&&e.parent(o.mainContainer)||!e.find(" > "+o.dropdown+", > * > "+o.dropdown)&&!l||(u=a.parent(".g-sublevel")||a.parent(".g-toplevel"),i=e.find(".g-sublevel"),s=e.parent(".g-dropdown-column"),u&&((c=a.parent(o.mainContainer))&&u.matches(".g-toplevel")||this._fixHeights(u,i,l,c),(u=!c&&s&&(r=s.search("> .g-grid > .g-block"))&&1 .g-sublevel"):u)[n?"removeClass":"addClass"]("g-slide-out"))),this[n?"closeDropdown":"openDropdown"](e),void("click"!==t.type&&this.toggleOverlay(a.parent(o.mainContainer)))))},openDropdown:function(t){var e=(t=f(t.target||t)).find(this.selectors.dropdown);t.addClass(this.states.selected),e&&e.removeClass(this.states.inactive).addClass(this.states.active)},closeDropdown:function(t){var e,n,i=(t=f(t.target||t)).find(this.selectors.dropdown);t.removeClass(this.states.selected),i&&(e=i.search(".g-sublevel"),n=i.search(".g-slide-out, ."+this.states.selected),t=i.search("."+this.states.active),e&&e.attribute("style",null),n&&n.removeClass("g-slide-out").removeClass(this.states.selected),t&&t.removeClass(this.states.active).addClass(this.states.inactive),i.removeClass(this.states.active).addClass(this.states.inactive))},closeAllDropdowns:function(){var t=this.selectors,e=this.states,n=f(t.mainContainer+" > .g-toplevel"),t=n.search(" >"+t.item);t&&t.removeClass(e.selected),n&&((e=n.search("> "+this.options.selectors.item))&&e.forEach(this.closeDropdown.bind(this)),this.closeDropdown(n)),this.toggleOverlay(n)},resetStates:function(t){var e,n;t&&(e=t.search(".g-toplevel, .g-dropdown-column, .g-dropdown, .g-selected, .g-active, .g-slide-out"),n=t.search(".g-active"),e&&(t.attribute("style",null).removeClass("g-selected").removeClass("g-slide-out"),e.attribute("style",null).removeClass("g-selected").removeClass("g-slide-out"),n&&n.removeClass("g-active").addClass("g-inactive")))},toggleOverlay:function(t){t&&(t=!!t.find(".g-active, .g-selected"),this.overlay[t?"addClass":"removeClass"]("g-menu-overlay-open"),this.overlay[0].style.opacity=t?1:0)},_fixHeights:function(t,e,n,i){var r,o,s,a,u;t!=e&&(n&&t.attribute("style",null),r={from:t[0].getBoundingClientRect(),to:(i?e:e.parent(".g-dropdown"))[0].getBoundingClientRect()},o=Math.max(r.from.height,r.to.height),n&&(t.parents('[style^="height"]')||[]).forEach(function(t){(t=f(t)).parent(".g-toplevel")&&(t[0].style.height=r.from.height+"px")}),n||(r.from.height .g-grid > .g-block"),u=s,a.forEach(function(t,e){e+1!=a.length?u-=t.getBoundingClientRect().height:f(t).find(".g-sublevel")[0].style.height=u+"px"})):e[0].style.height=s+"px")))},_calculateBreakpoint:function(t){var e=parseFloat(t.match(/^\d{1,}/).shift()),t=t.match(/[a-z]{1,}$/i).shift();return e+(t.match(/r?em/)?-.062:-1)+t},_checkQuery:function(t){var e,n,i=this.options.selectors,r=f(i.mobileContainer),o=f(i.mainContainer+i.mobileTarget)||f(i.mainContainer);t.matches?(e=o.find(i.topLevel))&&(o.parent(".g-block").addClass("hidden"),r.parent(".g-block").removeClass("hidden"),e.top(r)):(e=r.find(i.topLevel))&&(r.parent(".g-block").addClass("hidden"),o.parent(".g-block").removeClass("hidden"),e.top(o)),this.resetStates(e),!t.matches&&e&&(n=e.search("[data-g-item-width]"))&&n.forEach(function(t){(t=f(t))[0].style.width=t.data("g-item-width")})},_debug:function(){}});a.exports=i}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils/dollar-extras":6,domready:7,"elements/zen":36,"mout/function/bind":40,"mout/function/timeout":44,prime:85,"prime-util/prime/bound":81,"prime-util/prime/options":82}],3:[function(t,e,n){"use strict";t("domready");var i,r=t("prime"),o=t("mout/function/bind"),s=t("mout/array/forEach"),a=t("mout/math/map"),u=t("mout/math/clamp"),c=t("mout/function/timeout"),l=t("mout/string/trim"),f=t("../utils/decouple"),h=t("prime-util/prime/bound"),d=t("prime-util/prime/options"),p=t("elements"),m=t("elements/zen"),v=(t=window.getComputedStyle(document.documentElement,""),t=(Array.prototype.slice.call(t).join("").match(/-(moz|webkit|ms)-/)||""===t.OLink&&["","o"])[1],{dom:"WebKit|Moz|MS|O".match(new RegExp("("+t+")","i"))[1],lowercase:t,css:"-"+t+"-",js:t[0].toUpperCase()+t.substr(1)}),g="ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch,y=!1,d=new r({mixin:[h,d],options:{effect:"ease",duration:300,tolerance:function(t){return t/3},padding:0,touch:!0,css3:!0,openClass:"g-offcanvas-open",openingClass:"g-offcanvas-opening",closingClass:"g-offcanvas-closing",overlayClass:"g-nav-overlay"},constructor:function(t){if(this.setOptions(t),this.attached=!1,this.opening=!1,this.moved=!1,this.dragging=!1,this.opened=!1,this.preventOpen=!1,this.offset={x:{start:0,current:0},y:{start:0,current:0}},this.bodyEl=p("body"),this.htmlEl=p("html"),this.panel=p("#g-page-surround"),this.offcanvas=p("#g-offcanvas"),!this.panel||!this.offcanvas)return!1;var e=this.offcanvas.data("g-offcanvas-swipe"),t=this.offcanvas.data("g-offcanvas-css3");return this.setOptions({touch:!(null!==e&&!parseInt(e)),css3:!(null!==t&&!parseInt(t))}),this.options.padding||(this.offcanvas[0].style.display="block",t=this.offcanvas[0].getBoundingClientRect().width,this.offcanvas[0].style.removeProperty("display"),this.setOptions({padding:t})),this.tolerance="function"==typeof this.options.tolerance?this.options.tolerance.call(this,this.options.padding):this.options.tolerance,this.htmlEl.addClass("g-offcanvas-"+(this.options.css3?"css3":"css2")),this.attach(),this._checkTogglers(),this},attach:function(){return this.attached=!0,this.options.touch&&g&&this.attachTouchEvents(),s(["toggle","open","close"],o(function(t){this.bodyEl.delegate("click","[data-offcanvas-"+t+"]",this.bound(t)),g&&this.bodyEl.delegate("touchend","[data-offcanvas-"+t+"]",this.bound(t))},this)),this.attachMutationEvent(),this.overlay=m("div[data-offcanvas-close]."+this.options.overlayClass).top(this.panel),this},attachMutationEvent:function(){this.offcanvas instanceof Node&&new MutationObserver(this.bound("_checkTogglers")).observe(this.offcanvas,{childList:!0,subtree:!0})},attachTouchEvents:function(){var t=window.navigator.msPointerEnabled,t={start:t?"MSPointerDown":"touchstart",move:t?"MSPointerMove":"touchmove",end:t?"MSPointerUp":"touchend"};this._scrollBound=f(window,"scroll",this.bound("_bodyScroll")),this.bodyEl.on(t.move,this.bound("_bodyMove")),this.panel.on(t.start,this.bound("_touchStart")),this.panel.on("touchcancel",this.bound("_touchCancel")),this.panel.on(t.end,this.bound("_touchEnd")),this.panel.on(t.move,this.bound("_touchMove"))},detach:function(){return this.attached=!1,this.options.touch&&g&&this.detachTouchEvents(),s(["toggle","open","close"],o(function(t){this.bodyEl.undelegate("click","[data-offcanvas-"+t+"]",this.bound(t)),g&&this.bodyEl.undelegate("touchend","[data-offcanvas-"+t+"]",this.bound(t))},this)),this.detachMutationEvent(),this.overlay.remove(),this},detachMutationEvent:function(){this.offcanvas instanceof Node&&new MutationObserver(this.bound("_checkTogglers")).disconnect()},detachTouchEvents:function(){var t=window.navigator.msPointerEnabled,t={start:t?"MSPointerDown":"touchstart",move:t?"MSPointerMove":"touchmove",end:t?"MSPointerUp":"touchend"};window.removeEventListener("scroll",this._scrollBound),this.bodyEl.off(t.move,this.bound("_bodyMove")),this.panel.off(t.start,this.bound("_touchStart")),this.panel.off("touchcancel",this.bound("_touchCancel")),this.panel.off(t.end,this.bound("_touchEnd")),this.panel.off(t.move,this.bound("_touchMove"))},open:function(t){return t&&t.type.match(/^touch/i)?t.preventDefault():this.dragging=!1,this.opened||(this.htmlEl.addClass(this.options.openClass),this.htmlEl.addClass(this.options.openingClass),this.overlay[0].style.opacity=1,this.options.css3&&(this.panel[0].style[this.getOffcanvasPosition()]="inherit"),this._setTransition(),this._translateXTo((this.bodyEl.hasClass("g-offcanvas-right")?-1:1)*this.options.padding),this.opened=!0,setTimeout(o(function(){var t=this.panel[0];this.htmlEl.removeClass(this.options.openingClass),this.offcanvas.attribute("aria-expanded",!0),p("[data-offcanvas-toggle]").attribute("aria-expanded",!0),t.style.transition=t.style[v.css+"transition"]=""},this),this.options.duration)),this},close:function(t,e){return t&&t.type.match(/^touch/i)?t.preventDefault():this.dragging=!1,e=e||window,this.opened||this.opening?(this.panel===e||!this.dragging)&&(this.htmlEl.addClass(this.options.closingClass),this.overlay[0].style.opacity=0,this._setTransition(),this._translateXTo(0),this.opened=!1,this.offcanvas.attribute("aria-expanded",!1),p("[data-offcanvas-toggle]").attribute("aria-expanded",!1),setTimeout(o(function(){var t=this.panel[0];this.htmlEl.removeClass(this.options.openClass),this.htmlEl.removeClass(this.options.closingClass),t.style.transition=t.style[v.css+"transition"]="",t.style.transform=t.style[v.css+"transform"]="",t.style[this.getOffcanvasPosition()]=""},this),this.options.duration),this):this},toggle:function(t,e){return t&&t.type.match(/^touch/i)?t.preventDefault():this.dragging=!1,this[this.opened?"close":"open"](t,e)},getOffcanvasPosition:function(){return this.bodyEl.hasClass("g-offcanvas-right")?"right":"left"},_setTransition:function(){var t=this.panel[0];this.options.css3?t.style[v.css+"transition"]=t.style.transition=v.css+"transform "+this.options.duration+"ms "+this.options.effect:t.style[v.css+"transition"]=t.style.transition="left "+this.options.duration+"ms "+this.options.effect+", right "+this.options.duration+"ms "+this.options.effect},_translateXTo:function(t){var e=this.panel[0],n=this.getOffcanvasPosition();this.offset.x.current=t,this.options.css3?e.style[v.css+"transform"]=e.style.transform="translate3d("+t+"px, 0, 0)":e.style[n]=Math.abs(t)+"px"},_bodyScroll:function(){this.moved||(clearTimeout(i),y=!0,i=setTimeout(function(){y=!1},250))},_bodyMove:function(){return this.moved&&event.preventDefault(),!(this.dragging=!0)},_touchStart:function(t){t.touches&&(this.moved=!1,this.opening=!1,this.dragging=!1,this.offset.x.start=t.touches[0].pageX,this.offset.y.start=t.touches[0].pageY,this.preventOpen=!this.opened&&0!==this.offcanvas[0].clientWidth)},_touchCancel:function(){this.moved=!1,this.opening=!1},_touchMove:function(t){var e,n,i,r;y||this.preventOpen||!t.touches||(this.options.css3&&(this.panel[0].style[this.getOffcanvasPosition()]="inherit"),e=this.getOffcanvasPosition(),n=u(t.touches[0].clientX-this.offset.x.start,-this.options.padding,this.options.padding),i=this.offset.x.current=n,r=Math.abs(t.touches[0].pageY-this.offset.y.start),t="right"==e?-1:1,Math.abs(i)>this.options.padding||5this.tolerance,n=!!this.bodyEl.hasClass("g-offcanvas-right")?0",t))},firstChild:function(t){return this.find(i("^",t))},lastChild:function(t){return this.find(i("!^",t))},parent:function(t){var e=[];t:for(var n,i=0;n=this[i];i++)for(;(n=n.parentNode)&&n!==document;)if(!t||o.matches(n,t)){e.push(n);break t}return s(e)},parents:function(t){for(var e,n=[],i=0;e=this[i];i++)for(;(e=e.parentNode)&&e!==document;)t&&!o.matches(e,t)||n.push(e);return s(n)}}),e.exports=s},{"./base":9,"mout/array/map":18,slick:97}],36:[function(t,e,n){"use strict";var s=t("mout/array/forEach"),i=t("mout/array/map"),r=t("slick/parser"),a=t("./base");e.exports=function(t,o){return a(i(r(t),function(t){var n,r;return s(t,function(t,e){var i=(o||document).createElement(t.tag);t.id&&(i.id=t.id),t.classList&&(i.className=t.classList.join(" ")),t.attributes&&s(t.attributes,function(t){i.setAttribute(t.name,t.value||"")}),t.pseudos&&s(t.pseudos,function(t){var e=a(i),n=e[t.name];n&&n.call(e,t.value)}),0===e?r=i:" "===t.combinator?n.appendChild(i):"+"!==t.combinator||(t=n.parentNode)&&t.appendChild(i),n=i}),r}))}},{"./base":9,"mout/array/forEach":16,"mout/array/map":18,"slick/parser":98}],37:[function(t,e,n){e.exports=function(t,e,n){if(null!=t)for(var i=-1,r=t.length;++i',!!this.getElementById(e)},QUERY_SELECTOR:function(t){return t.innerHTML="_",t.innerHTML='',1===t.querySelectorAll(".MiX").length},EXPANDOS:function(t,e){return e="slick_"+a++,t._custom_property_=e,t._custom_property_===e},MATCHES_SELECTOR:function(e){e.className="MiX";var n=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector;if(n)try{n.call(e,":slick")}catch(t){return!!n.call(e,".MiX")&&n}return!1},GET_ELEMENTS_BY_CLASS_NAME:function(t){return t.innerHTML='',1===t.getElementsByClassName("b").length&&(t.firstChild.className="b",2===t.getElementsByClassName("b").length&&(t.innerHTML='',2===t.getElementsByClassName("a").length))},GET_ATTRIBUTE:function(t){var e="fus ro dah";return t.innerHTML='',t.firstChild.getAttribute("class")===e}};r.prototype.has=function(t){var e=this.tested,n=e[t];if(null!=n)return n;var i=this.root,r=this.document,o=r.createElement("div");o.setAttribute("style","display: none;"),i.appendChild(o);var s=u[t],n=!1;if(s)try{n=s.call(r,o)}catch(t){}return _.debug&&!n&&console.warn("document has no "+t),i.removeChild(o),e[t]=n};var x={" ":function(t,e,n){var i,r,o=!e.id,s=!e.tag,a=!e.classes;if(e.id&&t.getElementById&&this.has("GET_ELEMENT_BY_ID")&&(i=t.getElementById(e.id))&&i.getAttribute("id")===e.id&&(r=[i],o=!0,"*"===e.tag&&(s=!0)),!r&&(e.classes&&t.getElementsByClassName&&this.has("GET_ELEMENTS_BY_CLASS_NAME")?(r=t.getElementsByClassName(e.classList),a=!0,"*"===e.tag&&(s=!0)):(r=t.getElementsByTagName(e.tag),"*"!==e.tag&&(s=!0)),!r||!r.length))return!1;for(var u=0;i=r[u++];)(s&&o&&a&&!e.attributes&&!e.pseudos||this.match(i,e,s,o,a))&&n(i);return!0},">":function(t,e,n){if(t=t.firstChild)for(;1==t.nodeType&&this.match(t,e)&&n(t),t=t.nextSibling;);},"+":function(t,e,n){for(;t=t.nextSibling;)if(1==t.nodeType){this.match(t,e)&&n(t);break}},"^":function(t,e,n){(t=t.firstChild)&&(1===t.nodeType?this.match(t,e)&&n(t):x["+"].call(this,t,e,n))},"~":function(t,e,n){for(;t=t.nextSibling;)1===t.nodeType&&this.match(t,e)&&n(t)},"++":function(t,e,n){x["+"].call(this,t,e,n),x["!+"].call(this,t,e,n)},"~~":function(t,e,n){x["~"].call(this,t,e,n),x["!~"].call(this,t,e,n)},"!":function(t,e,n){for(;t=t.parentNode;)t!==this.document&&this.match(t,e)&&n(t)},"!>":function(t,e,n){(t=t.parentNode)!==this.document&&this.match(t,e)&&n(t)},"!+":function(t,e,n){for(;t=t.previousSibling;)if(1==t.nodeType){this.match(t,e)&&n(t);break}},"!^":function(t,e,n){(t=t.lastChild)&&(1==t.nodeType?this.match(t,e)&&n(t):x["!+"].call(this,t,e,n))},"!~":function(t,e,n){for(;t=t.previousSibling;)1===t.nodeType&&this.match(t,e)&&n(t)}};r.prototype.search=function(t,e,n){t?!t.nodeType&&t.document&&(t=t.document):t=this.document;var i=b(e);if(!i||!i.length)throw new Error("invalid expression");var r,o,s,a,u,c=E(n=n||[])?function(t){n[n.length]=t}:function(t){n[n.length++]=t};1+)\\s*|(\\s+)|(+|\\*)|\\#(+)|\\.(+)|\\[\\s*(+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)".replace(//,"["+y(">+~`!@$%^&={}\\;/g,"(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])").replace(//g,"(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])")),w=function(t){this.combinator=t||" ",this.tag="*"};w.prototype.toString=function(){if(!this.raw){var t,e,n="";if(n+=this.tag||"*",this.id&&(n+="#"+this.id),this.classes&&(n+="."+this.classList.join(".")),this.attributes)for(t=0;e=this.attributes[t++];)n+="["+e.name+(e.operator?e.operator+'"'+e.value+'"':"")+"]";if(this.pseudos)for(t=0;e=this.pseudos[t++];)n+=":"+e.name,e.value&&(n+="("+e.value+")");this.raw=n}return this.raw};var E=function(){this.length=0};E.prototype.toString=function(){if(!this.raw){for(var t,e="",n=0;t=this[n++];)1!==n&&(e+=" ")," "!==t.combinator&&(e+=t.combinator+" "),e+=t;this.raw=e}return this.raw};function s(t,e,n,i,r,o,s,a,u,c,l,f,h,d,p,m){var v,g;return(!e&&this.length||(v=this[this.length++]=new E,!e))&&(v=v||this[this.length-1],g=(g=n||i||!v.length?v[v.length++]=new w(n):g)||v[v.length-1],r?g.tag=b(r):o?g.id=b(o):s?(r=b(s),(o=g.classes||(g.classes={}))[r]||(o[r]=y(s),(s=g.classList||(g.classList=[])).push(r),s.sort())):h?(m=m||p,(g.pseudos||(g.pseudos=[])).push({type:1==f.length?"class":"element",name:b(h),escapedName:y(h),value:m?b(m):null,escapedValue:m?y(m):null})):a&&(l=l?y(l):null,(g.attributes||(g.attributes=[])).push({operator:u,name:b(a),escapedName:y(a),value:l?b(l):null,escapedValue:l?y(l):null}))),""}function a(t){this.length=0;for(var e,n=this,i=t;t;){if((e=t.replace(o,function(){return s.apply(n,arguments)}))===t)throw new Error(i+" is an invalid expression");t=e}}a.prototype.toString=function(){if(!this.raw){for(var t,e=[],n=0;t=this[n++];)e.push(t);this.raw=e.join(", ")}return this.raw};var u={};e.exports=function(t){return null==t?null:(t=(""+t).replace(/^\s+|\s+$/g,""),u[t]||(u[t]=new a(t)))}},{}],99:[function(t,e,n){var i,r,e=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(i===setTimeout)return setTimeout(e,0);if((i===o||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:o}catch(t){i=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,c=[],l=!1,f=-1;function h(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&d())}function d(){if(!l){var t=a(h);l=!0;for(var e=c.length;e;){for(u=c,c=[];++f ul > li', + parent: '.g-parent', + item: '.g-menu-item', + dropdown: '.g-dropdown', + overlay: '.g-menu-overlay', + touchIndicator: '.g-menu-parent-indicator', + linkedParent: '[data-g-menuparent]', + mobileTarget: '[data-g-mobile-target]' + }, + + states: { + active: 'g-active', + inactive: 'g-inactive', + selected: 'g-selected', + touchEvents: 'g-menu-hastouch' + } + }, + + constructor: function(options) { + this.setOptions(options); + + this.selectors = this.options.selectors; + this.states = this.options.states; + this.overlay = zen('div' + this.selectors.overlay); + this.active = null; + this.location = []; + + var pageSurround = $('#g-page-surround'); + if (pageSurround) { + this.overlay.top(pageSurround); + } + + var mainContainer = $(this.selectors.mainContainer); + if (!mainContainer) { return; } + + var gHoverExpand = mainContainer.data('g-hover-expand'); + + this.hoverExpand = gHoverExpand === null || gHoverExpand === 'true'; + if (hasTouchEvents || !this.hoverExpand) { + mainContainer.addClass(this.states.touchEvents); + } + + this.attach(); + }, + + attach: function() { + var selectors = this.selectors, + main = $(selectors.mainContainer + ' ' + selectors.item), + mobileContainer = $(selectors.mobileContainer), + body = $('body'); + + if (!main) { return; } + if (this.hoverExpand) { + main.on('mouseenter', this.bound('mouseenter')); + main.on('mouseleave', this.bound('mouseleave')); + } + + body.delegate('click', ':not(' + selectors.mainContainer + ') ' + selectors.linkedParent + ', .g-fullwidth .g-sublevel ' + selectors.linkedParent, this.bound('click')); + body.delegate('click', ':not(' + selectors.mainContainer + ') a[href]', this.bound('resetAfterClick')); + + if (hasTouchEvents || !this.hoverExpand) { + var linkedParent = $(selectors.linkedParent); + if (linkedParent) { + linkedParent.on('touchmove', this.bound('touchmove')); + linkedParent.on('touchend', this.bound('touchend')); + } + this.overlay.on('touchend', this.bound('closeAllDropdowns')); + } + + if (mobileContainer) { + var query = 'only all and (max-width: ' + this._calculateBreakpoint((mobileContainer.data('g-menu-breakpoint') || '48rem')) + ')', + match = matchMedia(query); + match.addListener(this.bound('_checkQuery')); + this._checkQuery(match); + } + }, + + detach: function() {}, + + click: function(event) { + this.touchend(event); + }, + + resetAfterClick: function(event) { + var target = $(event.target); + + if (target.data('g-menuparent') !== null) { + return true; + } + + this.closeDropdown(event); + if (global.G5 && global.G5.offcanvas) { + G5.offcanvas.close(); + } + }, + + mouseenter: function(event) { + var element = $(event.target); + if (!element.parent(this.options.selectors.mainContainer)) { return; } + if (element.parent(this.options.selectors.item) && !element.parent('.g-standard')) { return; } + + this.openDropdown(element); + }, + + mouseleave: function(event) { + var element = $(event.target); + if (!element.parent(this.options.selectors.mainContainer)) { return; } + if (element.parent(this.options.selectors.item) && !element.parent('.g-standard')) { return; } + + this.closeDropdown(element); + }, + + touchmove: function(event) { + var target = $(event.target); + target.isMoving = true; + }, + + touchend: function(event) { + var selectors = this.selectors, + states = this.states; + + var target = $(event.target), + indicator = target.parent(selectors.item).find(selectors.touchIndicator), + menuType = target.parent('.g-standard') ? 'standard' : 'megamenu', + isGoingBack = target.parent('.g-go-back'), + parent, isSelected; + + if (target.isMoving) { + target.isMoving = false; + return false; + } + + target.off('touchmove', this.bound('touchmove')); + target.isMoving = false; + + if (indicator) { + target = indicator; + } + + parent = target.matches(selectors.item) ? target : target.parent(selectors.item); + isSelected = parent.hasClass(states.selected); + + if (!parent.find(selectors.dropdown) && !indicator) { return true; } + + event.stopPropagation(); + if (!indicator || target.matches(selectors.touchIndicator)) { + event.preventDefault(); + } + + if (!isSelected) { + var siblings = parent.siblings(); + if (siblings) { + var currentlyOpen = siblings.search(selectors.touchIndicator + ' !> * !> ' + selectors.item + '.' + states.selected); + (currentlyOpen || []).forEach(bind(function(open) { + this.closeDropdown(open); + }, this)); + } + } + + if ((menuType == 'megamenu' || !parent.parent(selectors.mainContainer)) && (parent.find(' > ' + selectors.dropdown + ', > * > ' + selectors.dropdown) || isGoingBack)) { + var sublevel = target.parent('.g-sublevel') || target.parent('.g-toplevel'), + slideout = parent.find('.g-sublevel'), + columns = parent.parent('.g-dropdown-column'), + blocks; + + if (sublevel) { + var isNavMenu = target.parent(selectors.mainContainer); + if (!isNavMenu || (isNavMenu && !sublevel.matches('.g-toplevel'))) { this._fixHeights(sublevel, slideout, isGoingBack, isNavMenu); } + if (!isNavMenu && columns && (blocks = columns.search('> .g-grid > .g-block'))) { + if (blocks.length > 1) { sublevel = blocks.search('> .g-sublevel'); } + } + + sublevel[!isSelected ? 'addClass' : 'removeClass']('g-slide-out'); + } + } + + this[!isSelected ? 'openDropdown' : 'closeDropdown'](parent); + if (event.type !== 'click') { this.toggleOverlay(target.parent(selectors.mainContainer)); } + }, + + openDropdown: function(element) { + element = $(element.target || element); + var dropdown = element.find(this.selectors.dropdown); + + element.addClass(this.states.selected); + + if (dropdown) { + dropdown.removeClass(this.states.inactive).addClass(this.states.active); + } + }, + + closeDropdown: function(element) { + element = $(element.target || element); + var dropdown = element.find(this.selectors.dropdown); + + element.removeClass(this.states.selected); + + if (dropdown) { + var sublevels = dropdown.search('.g-sublevel'), + slideouts = dropdown.search('.g-slide-out, .' + this.states.selected), + actives = dropdown.search('.' + this.states.active); + + if (sublevels) { sublevels.attribute('style', null); } + if (slideouts) { slideouts.removeClass('g-slide-out').removeClass(this.states.selected); } + if (actives) { actives.removeClass(this.states.active).addClass(this.states.inactive); } + + dropdown.removeClass(this.states.active).addClass(this.states.inactive); + } + }, + + closeAllDropdowns: function() { + var selectors = this.selectors, + states = this.states, + topLevel = $(selectors.mainContainer + ' > .g-toplevel'), + roots = topLevel.search(' >' + selectors.item); + + if (roots) { roots.removeClass(states.selected); } + if (topLevel) { + var allRoots = topLevel.search('> ' + this.options.selectors.item); + if (allRoots) { allRoots.forEach(this.closeDropdown.bind(this)); } + this.closeDropdown(topLevel); + } + + this.toggleOverlay(topLevel); + }, + + resetStates: function(menu) { + if (!menu) { return; } + var items = menu.search('.g-toplevel, .g-dropdown-column, .g-dropdown, .g-selected, .g-active, .g-slide-out'), + actives = menu.search('.g-active'); + if (!items) { return; } + + menu.attribute('style', null).removeClass('g-selected').removeClass('g-slide-out'); + items.attribute('style', null).removeClass('g-selected').removeClass('g-slide-out'); + if (actives) { actives.removeClass('g-active').addClass('g-inactive'); } + }, + + toggleOverlay: function(menu) { + if (!menu) { return; } + var shouldOpen = !!menu.find('.g-active, .g-selected'); + + this.overlay[shouldOpen ? 'addClass' : 'removeClass']('g-menu-overlay-open'); + this.overlay[0].style.opacity = shouldOpen ? 1 : 0; + }, + + _fixHeights: function(parent, sublevel, isGoingBack, isNavMenu) { + if (parent == sublevel) { return; } + if (isGoingBack) { + parent.attribute('style', null); + } + + var parents, heights = { + from: parent[0].getBoundingClientRect(), + to: (!isNavMenu ? sublevel.parent('.g-dropdown')[0] : sublevel[0]).getBoundingClientRect() + }, + height = Math.max(heights.from.height, heights.to.height); + + if (isGoingBack) { + parents = parent.parents('[style^="height"]'); + (parents || []).forEach(function(element) { + element = $(element); + if (element.parent('.g-toplevel')) { + element[0].style.height = heights.from.height + 'px'; + } + }); + } + + if (!isGoingBack) { + // if from height is < than to height set the parent height else, set the target + if (heights.from.height < heights.to.height) { + parent[0].style.height = height + 'px'; + + parents = parent.parents('[style^="height"]'); + (parents || []).forEach(function(element) { + element = $(element); + if (element.parent('.g-toplevel')) { + element[0].style.height = height + 'px'; + } + }); + } else if (isNavMenu) { + sublevel[0].style.height = height + 'px'; + } + + // fix sublevels heights in side menu (offcanvas etc) + if (!isNavMenu) { + var maxHeight = height, + block = $(sublevel).parent('.g-block:not(.size-100)'), + column = block ? block.parent('.g-dropdown-column') : null; + (sublevel.parents('.g-slide-out, .g-dropdown-column') || parent).forEach(function(slideout) { + maxHeight = Math.max(height, parseInt(slideout.style.height || 0, 10)); + }); + + if (column) { + column[0].style.height = maxHeight + 'px'; + + var blocks = column.search('> .g-grid > .g-block'), + diff = maxHeight; + + blocks.forEach(function(block, i) { + if ((i + 1) != blocks.length) { + diff -= block.getBoundingClientRect().height; + } else { + $(block).find('.g-sublevel')[0].style.height = diff + 'px'; + } + }); + + + } else { + sublevel[0].style.height = maxHeight + 'px'; + } + } + } + }, + + _calculateBreakpoint: function(value) { + var digit = parseFloat(value.match(/^\d{1,}/).shift()), + unit = value.match(/[a-z]{1,}$/i).shift(), + tolerance = unit.match(/r?em/) ? -0.062 : -1; + + return (digit + tolerance) + unit; + }, + + _checkQuery: function(mq) { + var selectors = this.options.selectors, + mobileContainer = $(selectors.mobileContainer), + mainContainer = $(selectors.mainContainer + selectors.mobileTarget) || $(selectors.mainContainer), + find, dropdowns; + + if (mq.matches) { + // move to Mobile Container + find = mainContainer.find(selectors.topLevel); + if (find) { + mainContainer.parent('.g-block').addClass('hidden'); + mobileContainer.parent('.g-block').removeClass('hidden'); + find.top(mobileContainer); + } + } else { + // move back to Original Location + find = mobileContainer.find(selectors.topLevel); + if (find) { + mobileContainer.parent('.g-block').addClass('hidden'); + mainContainer.parent('.g-block').removeClass('hidden'); + find.top(mainContainer); + } + } + + this.resetStates(find); + + // we need to reintroduce fixed widths for those dropdowns that come with it + if (!mq.matches && (find && (dropdowns = find.search('[data-g-item-width]')))) { + dropdowns.forEach(function(dropdown) { + dropdown = $(dropdown); + dropdown[0].style.width = dropdown.data('g-item-width'); + }); + } + }, + + _debug: function() {} +}); + +module.exports = Menu; + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{"../utils/dollar-extras":6,"domready":7,"elements/zen":36,"mout/function/bind":40,"mout/function/timeout":44,"prime":85,"prime-util/prime/bound":81,"prime-util/prime/options":82}],3:[function(require,module,exports){ +// Offcanvas slide with desktop, touch and all-in-one touch devices support that supports both left and right placement. +// Fast and optimized using CSS3 transitions +// Based on the awesome Slideout.js + +"use strict"; + +var ready = require('domready'), + prime = require('prime'), + bind = require('mout/function/bind'), + forEach = require('mout/array/forEach'), + mapNumber = require('mout/math/map'), + clamp = require('mout/math/clamp'), + timeout = require('mout/function/timeout'), + trim = require('mout/string/trim'), + decouple = require('../utils/decouple'), + Bound = require('prime-util/prime/bound'), + Options = require('prime-util/prime/options'), + $ = require('elements'), + zen = require('elements/zen'); + +// thanks David Walsh +var prefix = (function() { + var styles = window.getComputedStyle(document.documentElement, ''), + pre = (Array.prototype.slice.call(styles).join('') + .match(/-(moz|webkit|ms)-/) || (styles.OLink === '' && ['', 'o']) + )[1], + dom = ('WebKit|Moz|MS|O').match(new RegExp('(' + pre + ')', 'i'))[1]; + return { + dom: dom, + lowercase: pre, + css: '-' + pre + '-', + js: pre[0].toUpperCase() + pre.substr(1) + }; +})(); + +var hasTouchEvents = ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch, + isScrolling = false, scrollTimeout; + +var Offcanvas = new prime({ + + mixin: [Bound, Options], + + options: { + effect: 'ease', + duration: 300, + tolerance: function(padding) { // tolerance can also be just an integer value + return padding / 3; + }, + padding: 0, + touch: true, + css3: true, + + openClass: 'g-offcanvas-open', + openingClass: 'g-offcanvas-opening', + closingClass: 'g-offcanvas-closing', + overlayClass: 'g-nav-overlay' + }, + + constructor: function(options) { + this.setOptions(options); + + this.attached = false; + this.opening = false; + this.moved = false; + this.dragging = false; + this.opened = false; + this.preventOpen = false; + this.offset = { + x: { + start: 0, + current: 0 + }, + y: { + start: 0, + current: 0 + } + }; + + this.bodyEl = $('body'); + this.htmlEl = $('html'); + + this.panel = $('#g-page-surround'); + this.offcanvas = $('#g-offcanvas'); + + if (!this.panel || !this.offcanvas) { return false; } + + var swipe = this.offcanvas.data('g-offcanvas-swipe'), + css3 = this.offcanvas.data('g-offcanvas-css3'); + this.setOptions({ touch: !!(swipe !== null ? parseInt(swipe) : 1), css3: !!(css3 !== null ? parseInt(css3) : 1) }); + + if (!this.options.padding) { + this.offcanvas[0].style.display = 'block'; + var width = this.offcanvas[0].getBoundingClientRect().width; + this.offcanvas[0].style.removeProperty('display'); + + this.setOptions({ padding: width }); + } + + this.tolerance = typeof this.options.tolerance == 'function' ? this.options.tolerance.call(this, this.options.padding) : this.options.tolerance; + + this.htmlEl.addClass('g-offcanvas-' + (this.options.css3 ? 'css3' : 'css2')); + + this.attach(); + this._checkTogglers(); + + return this; + }, + + attach: function() { + this.attached = true; + + if (this.options.touch && hasTouchEvents) { + this.attachTouchEvents(); + } + + forEach(['toggle', 'open', 'close'], bind(function(mode) { + this.bodyEl.delegate('click', '[data-offcanvas-' + mode + ']', this.bound(mode)); + if (hasTouchEvents) { this.bodyEl.delegate('touchend', '[data-offcanvas-' + mode + ']', this.bound(mode)); } + }, this)); + + this.attachMutationEvent(); + + this.overlay = zen('div[data-offcanvas-close].' + this.options.overlayClass).top(this.panel); + + return this; + }, + + attachMutationEvent: function () { + this.observer = new MutationObserver(() => { + this._checkTogglers(); + }); + this.observer.observe(this.offcanvas[0], { + childList: true, + subtree: true, + }); + }, + + attachTouchEvents: function() { + var msPointerSupported = window.navigator.msPointerEnabled, + touch = { + start: msPointerSupported ? 'MSPointerDown' : 'touchstart', + move: msPointerSupported ? 'MSPointerMove' : 'touchmove', + end: msPointerSupported ? 'MSPointerUp' : 'touchend' + }; + + this._scrollBound = decouple(window, 'scroll', this.bound('_bodyScroll')); + this.bodyEl.on(touch.move, this.bound('_bodyMove')); + this.panel.on(touch.start, this.bound('_touchStart')); + this.panel.on('touchcancel', this.bound('_touchCancel')); + this.panel.on(touch.end, this.bound('_touchEnd')); + this.panel.on(touch.move, this.bound('_touchMove')); + }, + + detach: function() { + this.attached = false; + + if (this.options.touch && hasTouchEvents) { + this.detachTouchEvents(); + } + + forEach(['toggle', 'open', 'close'], bind(function(mode) { + this.bodyEl.undelegate('click', '[data-offcanvas-' + mode + ']', this.bound(mode)); + if (hasTouchEvents) { this.bodyEl.undelegate('touchend', '[data-offcanvas-' + mode + ']', this.bound(mode)); } + }, this)); + + this.detachMutationEvent(); + this.overlay.remove(); + + return this; + }, + + detachMutationEvent: function () { + this.observer.disconnect(); + }, + + detachTouchEvents: function() { + var msPointerSupported = window.navigator.msPointerEnabled, + touch = { + start: msPointerSupported ? 'MSPointerDown' : 'touchstart', + move: msPointerSupported ? 'MSPointerMove' : 'touchmove', + end: msPointerSupported ? 'MSPointerUp' : 'touchend' + }; + + window.removeEventListener('scroll', this._scrollBound); + this.bodyEl.off(touch.move, this.bound('_bodyMove')); + this.panel.off(touch.start, this.bound('_touchStart')); + this.panel.off('touchcancel', this.bound('_touchCancel')); + this.panel.off(touch.end, this.bound('_touchEnd')); + this.panel.off(touch.move, this.bound('_touchMove')); + }, + + + open: function(event) { + if (event && event.type.match(/^touch/i)) { event.preventDefault(); } + else { this.dragging = false; } + + if (this.opened) { return this; } + + this.htmlEl.addClass(this.options.openClass); + this.htmlEl.addClass(this.options.openingClass); + + this.overlay[0].style.opacity = 1; + + if (this.options.css3) { + // for translate3d + this.panel[0].style[this.getOffcanvasPosition()] = 'inherit'; + } + + this._setTransition(); + this._translateXTo((this.bodyEl.hasClass('g-offcanvas-right') ? -1 : 1) * this.options.padding); + this.opened = true; + + setTimeout(bind(function() { + var panel = this.panel[0]; + + this.htmlEl.removeClass(this.options.openingClass); + this.offcanvas.attribute('aria-expanded', true); + $('[data-offcanvas-toggle]').attribute('aria-expanded', true); + panel.style.transition = panel.style[prefix.css + 'transition'] = ''; + }, this), this.options.duration); + + return this; + }, + + close: function(event, element) { + if (event && event.type.match(/^touch/i)) { event.preventDefault(); } + else { this.dragging = false; } + + element = element || window; + + if (!this.opened && !this.opening) { return this; } + if (this.panel !== element && this.dragging) { return false; } + + this.htmlEl.addClass(this.options.closingClass); + + this.overlay[0].style.opacity = 0; + + this._setTransition(); + this._translateXTo(0); + this.opened = false; + this.offcanvas.attribute('aria-expanded', false); + $('[data-offcanvas-toggle]').attribute('aria-expanded', false); + + setTimeout(bind(function() { + var panel = this.panel[0]; + + this.htmlEl.removeClass(this.options.openClass); + this.htmlEl.removeClass(this.options.closingClass); + panel.style.transition = panel.style[prefix.css + 'transition'] = ''; + panel.style.transform = panel.style[prefix.css + 'transform'] = ''; + panel.style[this.getOffcanvasPosition()] = ''; + }, this), this.options.duration); + + + return this; + }, + + toggle: function(event, element) { + if (event && event.type.match(/^touch/i)) { event.preventDefault(); } + else { this.dragging = false; } + + return this[this.opened ? 'close' : 'open'](event, element); + }, + + getOffcanvasPosition: function() { + return this.bodyEl.hasClass('g-offcanvas-right') ? 'right' : 'left'; + }, + + _setTransition: function() { + var panel = this.panel[0]; + + if (this.options.css3) { + // for translate3d + panel.style[prefix.css + 'transition'] = panel.style.transition = prefix.css + 'transform ' + this.options.duration + 'ms ' + this.options.effect; + } else { + // left/right transition + panel.style[prefix.css + 'transition'] = panel.style.transition = 'left ' + this.options.duration + 'ms ' + this.options.effect + ', right ' + this.options.duration + 'ms ' + this.options.effect; + } + }, + + _translateXTo: function(x) { + var panel = this.panel[0], + placement = this.getOffcanvasPosition(); + + this.offset.x.current = x; + + if (this.options.css3) { + // for translate3d + panel.style[prefix.css + 'transform'] = panel.style.transform = 'translate3d(' + x + 'px, 0, 0)'; + } else { + // left/right transition + panel.style[placement] = Math.abs(x) + 'px'; + } + }, + + _bodyScroll: function() { + if (!this.moved) { + clearTimeout(scrollTimeout); + isScrolling = true; + scrollTimeout = setTimeout(function() { + isScrolling = false; + }, 250); + } + }, + + _bodyMove: function() { + if (this.moved) { event.preventDefault(); } + this.dragging = true; + + return false; + }, + + _touchStart: function(event) { + if (!event.touches) { return; } + + this.moved = false; + this.opening = false; + this.dragging = false; + this.offset.x.start = event.touches[0].pageX; + this.offset.y.start = event.touches[0].pageY; + this.preventOpen = (!this.opened && this.offcanvas[0].clientWidth !== 0); + }, + + _touchCancel: function() { + this.moved = false; + this.opening = false; + }, + + _touchMove: function(event) { + if (isScrolling || this.preventOpen || !event.touches) { return; } + if (this.options.css3) { + this.panel[0].style[this.getOffcanvasPosition()] = 'inherit'; + } + + var placement = this.getOffcanvasPosition(), + diffX = clamp(event.touches[0].clientX - this.offset.x.start, -this.options.padding, this.options.padding), + translateX = this.offset.x.current = diffX, + diffY = Math.abs(event.touches[0].pageY - this.offset.y.start), + offset = placement == 'right' ? -1 : 1, + overlayOpacity; + + if (Math.abs(translateX) > this.options.padding) { return; } + if (diffY > 5 && !this.moved) { return; } + + if (Math.abs(diffX) > 0) { + this.opening = true; + + // offcanvas on left + if (placement == 'left' && (this.opened && diffX > 0 || !this.opened && diffX < 0)) { return; } + + // offcanvas on right + if (placement == 'right' && (this.opened && diffX < 0 || !this.opened && diffX > 0)) { return; } + + if (!this.moved && !this.htmlEl.hasClass(this.options.openClass)) { + this.htmlEl.addClass(this.options.openClass); + } + + if ((placement == 'left' && diffX <= 0) || (placement == 'right' && diffX >= 0)) { + translateX = diffX + (offset * this.options.padding); + this.opening = false; + } + + overlayOpacity = mapNumber(Math.abs(translateX), 0, this.options.padding, 0, 1); + this.overlay[0].style.opacity = overlayOpacity; + + if (this.options.css3) { + // for translate3d + this.panel[0].style[prefix.css + 'transform'] = this.panel[0].style.transform = 'translate3d(' + translateX + 'px, 0, 0)'; + } else { + // left/right transition + this.panel[0].style[placement] = Math.abs(translateX) + 'px'; + } + + this.moved = true; + } + }, + + _touchEnd: function(event) { + if (this.moved) { + var tolerance = Math.abs(this.offset.x.current) > this.tolerance, + placement = this.bodyEl.hasClass('g-offcanvas-right') ? true : false, + direction = !placement ? (this.offset.x.current < 0) : (this.offset.x.current > 0); + + this.opening = tolerance ? !direction : direction; + this.opened = !this.opening; + this[this.opening ? 'open' : 'close'](event, this.panel); + } + + this.moved = false; + + return true; + }, + + _checkTogglers: function(mutator) { + var togglers = $('[data-offcanvas-toggle], [data-offcanvas-open], [data-offcanvas-close]'), + mobileContainer = $('#g-mobilemenu-container'), + blocks, mCtext; + + if (!togglers || (mutator && ((mutator.target || mutator.srcElement) !== mobileContainer[0]))) { return; } + if (this.opened) { this.close(); } + + timeout(function() { + blocks = this.offcanvas.search('.g-block'); + mCtext = mobileContainer ? mobileContainer.text().length : 0; + var shouldCollapse = (blocks && blocks.length === 1) && mobileContainer && (!trim(this.offcanvas.text()).length && !blocks.find('.g-menu-item')); + + togglers[shouldCollapse ? 'addClass' : 'removeClass']('g-offcanvas-hide'); + if (mobileContainer) { + mobileContainer.parent('.g-block')[!mCtext ? 'addClass' : 'removeClass']('hidden'); + } + + if (!shouldCollapse && !this.attached) { this.attach(); } + else if (shouldCollapse && this.attached) { + this.detach(); + this.attachMutationEvent(); + } + }, 0, this); + } +}); + +module.exports = Offcanvas; + +},{"../utils/decouple":5,"domready":7,"elements":12,"elements/zen":36,"mout/array/forEach":37,"mout/function/bind":40,"mout/function/timeout":44,"mout/math/clamp":49,"mout/math/map":51,"mout/string/trim":60,"prime":85,"prime-util/prime/bound":81,"prime-util/prime/options":82}],4:[function(require,module,exports){ +"use strict"; + +var ready = require('domready'), + $ = require('../utils/dollar-extras'); + +var timeOut, + scrollToTop = function() { + if (document.body.scrollTop != 0 || document.documentElement.scrollTop != 0) { + window.scrollBy(0, -50); + timeOut = setTimeout(scrollToTop, 10); + } else { + clearTimeout(timeOut); + } + }; + +ready(function() { + var totop = $('#g-totop'); + if (!totop) { return; } + + totop.on('click', function(e) { + e.preventDefault(); + scrollToTop(); + }); +}); + +module.exports = {}; + +},{"../utils/dollar-extras":6,"domready":7}],5:[function(require,module,exports){ +'use strict'; + +var rAF = (function() { + return window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + function(callback) { window.setTimeout(callback, 1000 / 60); }; +}()); + +var decouple = function(element, event, callback) { + var evt, tracking = false; + element = element[0] || element; + + var capture = function(e) { + evt = e; + track(); + }; + + var track = function() { + if (!tracking) { + rAF(update); + tracking = true; + } + }; + + var update = function() { + callback.call(element, evt); + tracking = false; + }; + + try { + element.addEventListener(event, capture, false); + } catch (e) {} + + return capture; +}; + +module.exports = decouple; +},{}],6:[function(require,module,exports){ +"use strict"; +var $ = require('elements'), + map = require('mout/array/map'), + slick = require('slick'); + +var walk = function(combinator, method) { + + return function(expression) { + var parts = slick.parse(expression || "*"); + + expression = map(parts, function(part) { + return combinator + " " + part; + }).join(', '); + + return this[method](expression); + }; + +}; + + +$.implement({ + sibling: walk('++', 'find'), + siblings: walk('~~', 'search') +}); + + +module.exports = $; + +},{"elements":12,"mout/array/map":38,"slick":97}],7:[function(require,module,exports){ +/*! + * domready (c) Dustin Diaz 2014 - License MIT + */ +!function (name, definition) { + + if (typeof module != 'undefined') module.exports = definition() + else if (typeof define == 'function' && typeof define.amd == 'object') define(definition) + else this[name] = definition() + +}('domready', function () { + + var fns = [], listener + , doc = document + , hack = doc.documentElement.doScroll + , domContentLoaded = 'DOMContentLoaded' + , loaded = (hack ? /^loaded|^c/ : /^loaded|^i|^c/).test(doc.readyState) + + + if (!loaded) + doc.addEventListener(domContentLoaded, listener = function () { + doc.removeEventListener(domContentLoaded, listener) + loaded = 1 + while (listener = fns.shift()) listener() + }) + + return function (fn) { + loaded ? setTimeout(fn, 0) : fns.push(fn) + } + +}); + +},{}],8:[function(require,module,exports){ +/* +attributes +*/"use strict" + +var $ = require("./base") + +var trim = require("mout/string/trim"), + forEach = require("mout/array/forEach"), + filter = require("mout/array/filter"), + indexOf = require("mout/array/indexOf") + +// attributes + +$.implement({ + + setAttribute: function(name, value){ + return this.forEach(function(node){ + node.setAttribute(name, value) + }) + }, + + getAttribute: function(name){ + var attr = this[0].getAttributeNode(name) + return (attr && attr.specified) ? attr.value : null + }, + + hasAttribute: function(name){ + var node = this[0] + if (node.hasAttribute) return node.hasAttribute(name) + var attr = node.getAttributeNode(name) + return !!(attr && attr.specified) + }, + + removeAttribute: function(name){ + return this.forEach(function(node){ + var attr = node.getAttributeNode(name) + if (attr) node.removeAttributeNode(attr) + }) + } + +}) + +var accessors = {} + +forEach(["type", "value", "name", "href", "title", "id"], function(name){ + + accessors[name] = function(value){ + return (value !== undefined) ? this.forEach(function(node){ + node[name] = value + }) : this[0][name] + } + +}) + +// booleans + +forEach(["checked", "disabled", "selected"], function(name){ + + accessors[name] = function(value){ + return (value !== undefined) ? this.forEach(function(node){ + node[name] = !!value + }) : !!this[0][name] + } + +}) + +// className + +var classes = function(className){ + var classNames = trim(className).replace(/\s+/g, " ").split(" "), + uniques = {} + + return filter(classNames, function(className){ + if (className !== "" && !uniques[className]) return uniques[className] = className + }).sort() +} + +accessors.className = function(className){ + return (className !== undefined) ? this.forEach(function(node){ + node.className = classes(className).join(" ") + }) : classes(this[0].className).join(" ") +} + +// attribute + +$.implement({ + + attribute: function(name, value){ + var accessor = accessors[name] + if (accessor) return accessor.call(this, value) + if (value != null) return this.setAttribute(name, value) + if (value === null) return this.removeAttribute(name) + if (value === undefined) return this.getAttribute(name) + } + +}) + +$.implement(accessors) + +// shortcuts + +$.implement({ + + check: function(){ + return this.checked(true) + }, + + uncheck: function(){ + return this.checked(false) + }, + + disable: function(){ + return this.disabled(true) + }, + + enable: function(){ + return this.disabled(false) + }, + + select: function(){ + return this.selected(true) + }, + + deselect: function(){ + return this.selected(false) + } + +}) + +// classNames, has / add / remove Class + +$.implement({ + + classNames: function(){ + return classes(this[0].className) + }, + + hasClass: function(className){ + return indexOf(this.classNames(), className) > -1 + }, + + addClass: function(className){ + return this.forEach(function(node){ + var nodeClassName = node.className + var classNames = classes(nodeClassName + " " + className).join(" ") + if (nodeClassName !== classNames) node.className = classNames + }) + }, + + removeClass: function(className){ + return this.forEach(function(node){ + var classNames = classes(node.className) + forEach(classes(className), function(className){ + var index = indexOf(classNames, className) + if (index > -1) classNames.splice(index, 1) + }) + node.className = classNames.join(" ") + }) + }, + + toggleClass: function(className, force){ + var add = force !== undefined ? force : !this.hasClass(className) + if (add) + this.addClass(className) + else + this.removeClass(className) + return !!add + } + +}) + +// toString + +$.prototype.toString = function(){ + var tag = this.tag(), + id = this.id(), + classes = this.classNames() + + var str = tag + if (id) str += '#' + id + if (classes.length) str += '.' + classes.join(".") + return str +} + +var textProperty = (document.createElement('div').textContent == null) ? 'innerText' : 'textContent' + +// tag, html, text, data + +$.implement({ + + tag: function(){ + return this[0].tagName.toLowerCase() + }, + + html: function(html){ + return (html !== undefined) ? this.forEach(function(node){ + node.innerHTML = html + }) : this[0].innerHTML + }, + + text: function(text){ + return (text !== undefined) ? this.forEach(function(node){ + node[textProperty] = text + }) : this[0][textProperty] + }, + + data: function(key, value){ + switch(value) { + case undefined: return this.getAttribute("data-" + key) + case null: return this.removeAttribute("data-" + key) + default: return this.setAttribute("data-" + key, value) + } + } + +}) + +module.exports = $ + +},{"./base":9,"mout/array/filter":15,"mout/array/forEach":16,"mout/array/indexOf":17,"mout/string/trim":34}],9:[function(require,module,exports){ +/* +elements +*/"use strict" + +var prime = require("prime") + +var forEach = require("mout/array/forEach"), + map = require("mout/array/map"), + filter = require("mout/array/filter"), + every = require("mout/array/every"), + some = require("mout/array/some") + +// uniqueID + +var index = 0, + __dc = document.__counter, + counter = document.__counter = (__dc ? parseInt(__dc, 36) + 1 : 0).toString(36), + key = "uid:" + counter + +var uniqueID = function(n){ + if (n === window) return "window" + if (n === document) return "document" + if (n === document.documentElement) return "html" + return n[key] || (n[key] = (index++).toString(36)) +} + +var instances = {} + +// elements prime + +var $ = prime({constructor: function $(n, context){ + + if (n == null) return (this && this.constructor === $) ? new Elements : null + + var self, uid + + if (n.constructor !== Elements){ + + self = new Elements + + if (typeof n === "string"){ + if (!self.search) return null + self[self.length++] = context || document + return self.search(n) + } + + if (n.nodeType || n === window){ + + self[self.length++] = n + + } else if (n.length){ + + // this could be an array, or any object with a length attribute, + // including another instance of elements from another interface. + + var uniques = {} + + for (var i = 0, l = n.length; i < l; i++){ // perform elements flattening + var nodes = $(n[i], context) + if (nodes && nodes.length) for (var j = 0, k = nodes.length; j < k; j++){ + var node = nodes[j] + uid = uniqueID(node) + if (!uniques[uid]){ + self[self.length++] = node + uniques[uid] = true + } + } + } + + } + + } else { + self = n + } + + if (!self.length) return null + + // when length is 1 always use the same elements instance + + if (self.length === 1){ + uid = uniqueID(self[0]) + return instances[uid] || (instances[uid] = self) + } + + return self + +}}) + +var Elements = prime({ + + inherits: $, + + constructor: function Elements(){ + this.length = 0 + }, + + unlink: function(){ + return this.map(function(node){ + delete instances[uniqueID(node)] + return node + }) + }, + + // methods + + forEach: function(method, context){ + forEach(this, method, context) + return this + }, + + map: function(method, context){ + return map(this, method, context) + }, + + filter: function(method, context){ + return filter(this, method, context) + }, + + every: function(method, context){ + return every(this, method, context) + }, + + some: function(method, context){ + return some(this, method, context) + } + +}) + +module.exports = $ + +},{"mout/array/every":14,"mout/array/filter":15,"mout/array/forEach":16,"mout/array/map":18,"mout/array/some":19,"prime":85}],10:[function(require,module,exports){ +/* +delegation +*/"use strict" + +var Map = require("prime/map") + +var $ = require("./events") + require('./traversal') + +$.implement({ + + delegate: function(event, selector, handle, useCapture){ + + return this.forEach(function(node){ + + var self = $(node) + + var delegation = self._delegation || (self._delegation = {}), + events = delegation[event] || (delegation[event] = {}), + map = (events[selector] || (events[selector] = new Map)) + + if (map.get(handle)) return + + var action = function(e){ + var target = $(e.target || e.srcElement), + match = target.matches(selector) ? target : target.parent(selector) + + var res + + if (match) res = handle.call(self, e, match) + + return res + } + + map.set(handle, action) + + self.on(event, action, useCapture) + + }) + + }, + + undelegate: function(event, selector, handle, useCapture){ + + return this.forEach(function(node){ + + var self = $(node), delegation, events, map + + if (!(delegation = self._delegation) || !(events = delegation[event]) || !(map = events[selector])) return; + + var action = map.get(handle) + + if (action){ + self.off(event, action, useCapture) + map.remove(action) + + // if there are no more handles in a given selector, delete it + if (!map.count()) delete events[selector] + // var evc = evd = 0, x + var e1 = true, e2 = true, x + for (x in events){ + e1 = false + break + } + // if no more selectors in a given event type, delete it + if (e1) delete delegation[event] + for (x in delegation){ + e2 = false + break + } + // if there are no more delegation events in the element, delete the _delegation object + if (e2) delete self._delegation + } + + }) + + } + +}) + +module.exports = $ + +},{"./events":11,"./traversal":35,"prime/map":86}],11:[function(require,module,exports){ +/* +events +*/"use strict" + +var Emitter = require("prime/emitter") + +var $ = require("./base") + +var html = document.documentElement + +var addEventListener = html.addEventListener ? function(node, event, handle, useCapture){ + node.addEventListener(event, handle, useCapture || false) + return handle +} : function(node, event, handle){ + node.attachEvent('on' + event, handle) + return handle +} + +var removeEventListener = html.removeEventListener ? function(node, event, handle, useCapture){ + node.removeEventListener(event, handle, useCapture || false) +} : function(node, event, handle){ + node.detachEvent("on" + event, handle) +} + +$.implement({ + + on: function(event, handle, useCapture){ + + return this.forEach(function(node){ + var self = $(node) + + var internalEvent = event + (useCapture ? ":capture" : "") + + Emitter.prototype.on.call(self, internalEvent, handle) + + var domListeners = self._domListeners || (self._domListeners = {}) + if (!domListeners[internalEvent]) domListeners[internalEvent] = addEventListener(node, event, function(e){ + Emitter.prototype.emit.call(self, internalEvent, e || window.event, Emitter.EMIT_SYNC) + }, useCapture) + }) + }, + + off: function(event, handle, useCapture){ + + return this.forEach(function(node){ + + var self = $(node) + + var internalEvent = event + (useCapture ? ":capture" : "") + + var domListeners = self._domListeners, domEvent, listeners = self._listeners, events + + if (domListeners && (domEvent = domListeners[internalEvent]) && listeners && (events = listeners[internalEvent])){ + + Emitter.prototype.off.call(self, internalEvent, handle) + + if (!self._listeners || !self._listeners[event]){ + removeEventListener(node, event, domEvent) + delete domListeners[event] + + for (var l in domListeners) return + delete self._domListeners + } + + } + }) + }, + + emit: function(){ + var args = arguments + return this.forEach(function(node){ + Emitter.prototype.emit.apply($(node), args) + }) + } + +}) + +module.exports = $ + +},{"./base":9,"prime/emitter":84}],12:[function(require,module,exports){ +/* +elements +*/"use strict" + +var $ = require("./base") + require("./attributes") + require("./events") + require("./insertion") + require("./traversal") + require("./delegation") + +module.exports = $ + +},{"./attributes":8,"./base":9,"./delegation":10,"./events":11,"./insertion":13,"./traversal":35}],13:[function(require,module,exports){ +/* +insertion +*/"use strict" + +var $ = require("./base") + +// base insertion + +$.implement({ + + appendChild: function(child){ + this[0].appendChild($(child)[0]) + return this + }, + + insertBefore: function(child, ref){ + this[0].insertBefore($(child)[0], $(ref)[0]) + return this + }, + + removeChild: function(child){ + this[0].removeChild($(child)[0]) + return this + }, + + replaceChild: function(child, ref){ + this[0].replaceChild($(child)[0], $(ref)[0]) + return this + } + +}) + +// before, after, bottom, top + +$.implement({ + + before: function(element){ + element = $(element)[0] + var parent = element.parentNode + if (parent) this.forEach(function(node){ + parent.insertBefore(node, element) + }) + return this + }, + + after: function(element){ + element = $(element)[0] + var parent = element.parentNode + if (parent) this.forEach(function(node){ + parent.insertBefore(node, element.nextSibling) + }) + return this + }, + + bottom: function(element){ + element = $(element)[0] + return this.forEach(function(node){ + element.appendChild(node) + }) + }, + + top: function(element){ + element = $(element)[0] + return this.forEach(function(node){ + element.insertBefore(node, element.firstChild) + }) + } + +}) + +// insert, replace + +$.implement({ + + insert: $.prototype.bottom, + + remove: function(){ + return this.forEach(function(node){ + var parent = node.parentNode + if (parent) parent.removeChild(node) + }) + }, + + replace: function(element){ + element = $(element)[0] + element.parentNode.replaceChild(this[0], element) + return this + } + +}) + +module.exports = $ + +},{"./base":9}],14:[function(require,module,exports){ +var makeIterator = require('../function/makeIterator_'); + + /** + * Array every + */ + function every(arr, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var result = true; + if (arr == null) { + return result; + } + + var i = -1, len = arr.length; + while (++i < len) { + // we iterate over sparse items since there is no way to make it + // work properly on IE 7-8. see #64 + if (!callback(arr[i], i, arr) ) { + result = false; + break; + } + } + + return result; + } + + module.exports = every; + + +},{"../function/makeIterator_":21}],15:[function(require,module,exports){ +var makeIterator = require('../function/makeIterator_'); + + /** + * Array filter + */ + function filter(arr, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var results = []; + if (arr == null) { + return results; + } + + var i = -1, len = arr.length, value; + while (++i < len) { + value = arr[i]; + if (callback(value, i, arr)) { + results.push(value); + } + } + + return results; + } + + module.exports = filter; + + + +},{"../function/makeIterator_":21}],16:[function(require,module,exports){ + + + /** + * Array forEach + */ + function forEach(arr, callback, thisObj) { + if (arr == null) { + return; + } + var i = -1, + len = arr.length; + while (++i < len) { + // we iterate over sparse items since there is no way to make it + // work properly on IE 7-8. see #64 + if ( callback.call(thisObj, arr[i], i, arr) === false ) { + break; + } + } + } + + module.exports = forEach; + + + +},{}],17:[function(require,module,exports){ + + + /** + * Array.indexOf + */ + function indexOf(arr, item, fromIndex) { + fromIndex = fromIndex || 0; + if (arr == null) { + return -1; + } + + var len = arr.length, + i = fromIndex < 0 ? len + fromIndex : fromIndex; + while (i < len) { + // we iterate over sparse items since there is no way to make it + // work properly on IE 7-8. see #64 + if (arr[i] === item) { + return i; + } + + i++; + } + + return -1; + } + + module.exports = indexOf; + + +},{}],18:[function(require,module,exports){ +var makeIterator = require('../function/makeIterator_'); + + /** + * Array map + */ + function map(arr, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var results = []; + if (arr == null){ + return results; + } + + var i = -1, len = arr.length; + while (++i < len) { + results[i] = callback(arr[i], i, arr); + } + + return results; + } + + module.exports = map; + + +},{"../function/makeIterator_":21}],19:[function(require,module,exports){ +var makeIterator = require('../function/makeIterator_'); + + /** + * Array some + */ + function some(arr, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var result = false; + if (arr == null) { + return result; + } + + var i = -1, len = arr.length; + while (++i < len) { + // we iterate over sparse items since there is no way to make it + // work properly on IE 7-8. see #64 + if ( callback(arr[i], i, arr) ) { + result = true; + break; + } + } + + return result; + } + + module.exports = some; + + +},{"../function/makeIterator_":21}],20:[function(require,module,exports){ + + + /** + * Returns the first argument provided to it. + */ + function identity(val){ + return val; + } + + module.exports = identity; + + + +},{}],21:[function(require,module,exports){ +var identity = require('./identity'); +var prop = require('./prop'); +var deepMatches = require('../object/deepMatches'); + + /** + * Converts argument into a valid iterator. + * Used internally on most array/object/collection methods that receives a + * callback/iterator providing a shortcut syntax. + */ + function makeIterator(src, thisObj){ + if (src == null) { + return identity; + } + switch(typeof src) { + case 'function': + // function is the first to improve perf (most common case) + // also avoid using `Function#call` if not needed, which boosts + // perf a lot in some cases + return (typeof thisObj !== 'undefined')? function(val, i, arr){ + return src.call(thisObj, val, i, arr); + } : src; + case 'object': + return function(val){ + return deepMatches(val, src); + }; + case 'string': + case 'number': + return prop(src); + } + } + + module.exports = makeIterator; + + + +},{"../object/deepMatches":27,"./identity":20,"./prop":22}],22:[function(require,module,exports){ + + + /** + * Returns a function that gets a property of the passed object + */ + function prop(name){ + return function(obj){ + return obj[name]; + }; + } + + module.exports = prop; + + + +},{}],23:[function(require,module,exports){ +var isKind = require('./isKind'); + /** + */ + var isArray = Array.isArray || function (val) { + return isKind(val, 'Array'); + }; + module.exports = isArray; + + +},{"./isKind":24}],24:[function(require,module,exports){ +var kindOf = require('./kindOf'); + /** + * Check if value is from a specific "kind". + */ + function isKind(val, kind){ + return kindOf(val) === kind; + } + module.exports = isKind; + + +},{"./kindOf":25}],25:[function(require,module,exports){ + + + var _rKind = /^\[object (.*)\]$/, + _toString = Object.prototype.toString, + UNDEF; + + /** + * Gets the "kind" of value. (e.g. "String", "Number", etc) + */ + function kindOf(val) { + if (val === null) { + return 'Null'; + } else if (val === UNDEF) { + return 'Undefined'; + } else { + return _rKind.exec( _toString.call(val) )[1]; + } + } + module.exports = kindOf; + + +},{}],26:[function(require,module,exports){ + + + /** + * Typecast a value to a String, using an empty string value for null or + * undefined. + */ + function toString(val){ + return val == null ? '' : val.toString(); + } + + module.exports = toString; + + + +},{}],27:[function(require,module,exports){ +var forOwn = require('./forOwn'); +var isArray = require('../lang/isArray'); + + function containsMatch(array, pattern) { + var i = -1, length = array.length; + while (++i < length) { + if (deepMatches(array[i], pattern)) { + return true; + } + } + + return false; + } + + function matchArray(target, pattern) { + var i = -1, patternLength = pattern.length; + while (++i < patternLength) { + if (!containsMatch(target, pattern[i])) { + return false; + } + } + + return true; + } + + function matchObject(target, pattern) { + var result = true; + forOwn(pattern, function(val, key) { + if (!deepMatches(target[key], val)) { + // Return false to break out of forOwn early + return (result = false); + } + }); + + return result; + } + + /** + * Recursively check if the objects match. + */ + function deepMatches(target, pattern){ + if (target && typeof target === 'object') { + if (isArray(target) && isArray(pattern)) { + return matchArray(target, pattern); + } else { + return matchObject(target, pattern); + } + } else { + return target === pattern; + } + } + + module.exports = deepMatches; + + + +},{"../lang/isArray":23,"./forOwn":29}],28:[function(require,module,exports){ +var hasOwn = require('./hasOwn'); + + var _hasDontEnumBug, + _dontEnums; + + function checkDontEnum(){ + _dontEnums = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' + ]; + + _hasDontEnumBug = true; + + for (var key in {'toString': null}) { + _hasDontEnumBug = false; + } + } + + /** + * Similar to Array/forEach but works over object properties and fixes Don't + * Enum bug on IE. + * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation + */ + function forIn(obj, fn, thisObj){ + var key, i = 0; + // no need to check if argument is a real object that way we can use + // it for arrays, functions, date, etc. + + //post-pone check till needed + if (_hasDontEnumBug == null) checkDontEnum(); + + for (key in obj) { + if (exec(fn, obj, key, thisObj) === false) { + break; + } + } + + + if (_hasDontEnumBug) { + var ctor = obj.constructor, + isProto = !!ctor && obj === ctor.prototype; + + while (key = _dontEnums[i++]) { + // For constructor, if it is a prototype object the constructor + // is always non-enumerable unless defined otherwise (and + // enumerated above). For non-prototype objects, it will have + // to be defined on this object, since it cannot be defined on + // any prototype objects. + // + // For other [[DontEnum]] properties, check if the value is + // different than Object prototype value. + if ( + (key !== 'constructor' || + (!isProto && hasOwn(obj, key))) && + obj[key] !== Object.prototype[key] + ) { + if (exec(fn, obj, key, thisObj) === false) { + break; + } + } + } + } + } + + function exec(fn, obj, key, thisObj){ + return fn.call(thisObj, obj[key], key, obj); + } + + module.exports = forIn; + + + +},{"./hasOwn":30}],29:[function(require,module,exports){ +var hasOwn = require('./hasOwn'); +var forIn = require('./forIn'); + + /** + * Similar to Array/forEach but works over object properties and fixes Don't + * Enum bug on IE. + * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation + */ + function forOwn(obj, fn, thisObj){ + forIn(obj, function(val, key){ + if (hasOwn(obj, key)) { + return fn.call(thisObj, obj[key], key, obj); + } + }); + } + + module.exports = forOwn; + + + +},{"./forIn":28,"./hasOwn":30}],30:[function(require,module,exports){ + + + /** + * Safer Object.hasOwnProperty + */ + function hasOwn(obj, prop){ + return Object.prototype.hasOwnProperty.call(obj, prop); + } + + module.exports = hasOwn; + + + +},{}],31:[function(require,module,exports){ + + /** + * Contains all Unicode white-spaces. Taken from + * http://en.wikipedia.org/wiki/Whitespace_character. + */ + module.exports = [ + ' ', '\n', '\r', '\t', '\f', '\v', '\u00A0', '\u1680', '\u180E', + '\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005', '\u2006', + '\u2007', '\u2008', '\u2009', '\u200A', '\u2028', '\u2029', '\u202F', + '\u205F', '\u3000' + ]; + + +},{}],32:[function(require,module,exports){ +var toString = require('../lang/toString'); +var WHITE_SPACES = require('./WHITE_SPACES'); + /** + * Remove chars from beginning of string. + */ + function ltrim(str, chars) { + str = toString(str); + chars = chars || WHITE_SPACES; + + var start = 0, + len = str.length, + charLen = chars.length, + found = true, + i, c; + + while (found && start < len) { + found = false; + i = -1; + c = str.charAt(start); + + while (++i < charLen) { + if (c === chars[i]) { + found = true; + start++; + break; + } + } + } + + return (start >= len) ? '' : str.substr(start, len); + } + + module.exports = ltrim; + + +},{"../lang/toString":26,"./WHITE_SPACES":31}],33:[function(require,module,exports){ +var toString = require('../lang/toString'); +var WHITE_SPACES = require('./WHITE_SPACES'); + /** + * Remove chars from end of string. + */ + function rtrim(str, chars) { + str = toString(str); + chars = chars || WHITE_SPACES; + + var end = str.length - 1, + charLen = chars.length, + found = true, + i, c; + + while (found && end >= 0) { + found = false; + i = -1; + c = str.charAt(end); + + while (++i < charLen) { + if (c === chars[i]) { + found = true; + end--; + break; + } + } + } + + return (end >= 0) ? str.substring(0, end + 1) : ''; + } + + module.exports = rtrim; + + +},{"../lang/toString":26,"./WHITE_SPACES":31}],34:[function(require,module,exports){ +var toString = require('../lang/toString'); +var WHITE_SPACES = require('./WHITE_SPACES'); +var ltrim = require('./ltrim'); +var rtrim = require('./rtrim'); + /** + * Remove white-spaces from beginning and end of string. + */ + function trim(str, chars) { + str = toString(str); + chars = chars || WHITE_SPACES; + return ltrim(rtrim(str, chars), chars); + } + + module.exports = trim; + + +},{"../lang/toString":26,"./WHITE_SPACES":31,"./ltrim":32,"./rtrim":33}],35:[function(require,module,exports){ +/* +traversal +*/"use strict" + +var map = require("mout/array/map") + +var slick = require("slick") + +var $ = require("./base") + +var gen = function(combinator, expression){ + return map(slick.parse(expression || "*"), function(part){ + return combinator + " " + part + }).join(", ") +} + +var push_ = Array.prototype.push + +$.implement({ + + search: function(expression){ + if (this.length === 1) return $(slick.search(expression, this[0], new $)) + + var buffer = [] + for (var i = 0, node; node = this[i]; i++) push_.apply(buffer, slick.search(expression, node)) + buffer = $(buffer) + return buffer && buffer.sort() + }, + + find: function(expression){ + if (this.length === 1) return $(slick.find(expression, this[0])) + + for (var i = 0, node; node = this[i]; i++) { + var found = slick.find(expression, node) + if (found) return $(found) + } + + return null + }, + + sort: function(){ + return slick.sort(this) + }, + + matches: function(expression){ + return slick.matches(this[0], expression) + }, + + contains: function(node){ + return slick.contains(this[0], node) + }, + + nextSiblings: function(expression){ + return this.search(gen('~', expression)) + }, + + nextSibling: function(expression){ + return this.find(gen('+', expression)) + }, + + previousSiblings: function(expression){ + return this.search(gen('!~', expression)) + }, + + previousSibling: function(expression){ + return this.find(gen('!+', expression)) + }, + + children: function(expression){ + return this.search(gen('>', expression)) + }, + + firstChild: function(expression){ + return this.find(gen('^', expression)) + }, + + lastChild: function(expression){ + return this.find(gen('!^', expression)) + }, + + parent: function(expression){ + var buffer = [] + loop: for (var i = 0, node; node = this[i]; i++) while ((node = node.parentNode) && (node !== document)){ + if (!expression || slick.matches(node, expression)){ + buffer.push(node) + break loop + break + } + } + return $(buffer) + }, + + parents: function(expression){ + var buffer = [] + for (var i = 0, node; node = this[i]; i++) while ((node = node.parentNode) && (node !== document)){ + if (!expression || slick.matches(node, expression)) buffer.push(node) + } + return $(buffer) + } + +}) + +module.exports = $ + +},{"./base":9,"mout/array/map":18,"slick":97}],36:[function(require,module,exports){ +/* +zen +*/"use strict" + +var forEach = require("mout/array/forEach"), + map = require("mout/array/map") + +var parse = require("slick/parser") + +var $ = require("./base") + +module.exports = function(expression, doc){ + + return $(map(parse(expression), function(expression){ + + var previous, result + + forEach(expression, function(part, i){ + + var node = (doc || document).createElement(part.tag) + + if (part.id) node.id = part.id + + if (part.classList) node.className = part.classList.join(" ") + + if (part.attributes) forEach(part.attributes, function(attribute){ + node.setAttribute(attribute.name, attribute.value || "") + }) + + if (part.pseudos) forEach(part.pseudos, function(pseudo){ + var n = $(node), method = n[pseudo.name] + if (method) method.call(n, pseudo.value) + }) + + if (i === 0){ + + result = node + + } else if (part.combinator === " "){ + + previous.appendChild(node) + + } else if (part.combinator === "+"){ + var parentNode = previous.parentNode + if (parentNode) parentNode.appendChild(node) + } + + previous = node + + }) + + return result + + })) + +} + +},{"./base":9,"mout/array/forEach":16,"mout/array/map":18,"slick/parser":98}],37:[function(require,module,exports){ + + + /** + * Array forEach + */ + function forEach(arr, callback, thisObj) { + if (arr == null) { + return; + } + var i = -1, + len = arr.length; + while (++i < len) { + // we iterate over sparse items since there is no way to make it + // work properly on IE 7-8. see #64 + if ( callback.call(thisObj, arr[i], i, arr) === false ) { + break; + } + } + } + + module.exports = forEach; + + + +},{}],38:[function(require,module,exports){ +var makeIterator = require('../function/makeIterator_'); + + /** + * Array map + */ + function map(arr, callback, thisObj) { + callback = makeIterator(callback, thisObj); + var results = []; + if (arr == null){ + return results; + } + + var i = -1, len = arr.length; + while (++i < len) { + results[i] = callback(arr[i], i, arr); + } + + return results; + } + + module.exports = map; + + +},{"../function/makeIterator_":42}],39:[function(require,module,exports){ + + + /** + * Create slice of source array or array-like object + */ + function slice(arr, start, end){ + var len = arr.length; + + if (start == null) { + start = 0; + } else if (start < 0) { + start = Math.max(len + start, 0); + } else { + start = Math.min(start, len); + } + + if (end == null) { + end = len; + } else if (end < 0) { + end = Math.max(len + end, 0); + } else { + end = Math.min(end, len); + } + + var result = []; + while (start < end) { + result.push(arr[start++]); + } + + return result; + } + + module.exports = slice; + + + +},{}],40:[function(require,module,exports){ +var slice = require('../array/slice'); + + /** + * Return a function that will execute in the given context, optionally adding any additional supplied parameters to the beginning of the arguments collection. + * @param {Function} fn Function. + * @param {object} context Execution context. + * @param {rest} args Arguments (0...n arguments). + * @return {Function} Wrapped Function. + */ + function bind(fn, context, args){ + var argsArr = slice(arguments, 2); //curried args + return function(){ + return fn.apply(context, argsArr.concat(slice(arguments))); + }; + } + + module.exports = bind; + + + +},{"../array/slice":39}],41:[function(require,module,exports){ + + + /** + * Returns the first argument provided to it. + */ + function identity(val){ + return val; + } + + module.exports = identity; + + + +},{}],42:[function(require,module,exports){ +var identity = require('./identity'); +var prop = require('./prop'); +var deepMatches = require('../object/deepMatches'); + + /** + * Converts argument into a valid iterator. + * Used internally on most array/object/collection methods that receives a + * callback/iterator providing a shortcut syntax. + */ + function makeIterator(src, thisObj){ + if (src == null) { + return identity; + } + switch(typeof src) { + case 'function': + // function is the first to improve perf (most common case) + // also avoid using `Function#call` if not needed, which boosts + // perf a lot in some cases + return (typeof thisObj !== 'undefined')? function(val, i, arr){ + return src.call(thisObj, val, i, arr); + } : src; + case 'object': + return function(val){ + return deepMatches(val, src); + }; + case 'string': + case 'number': + return prop(src); + } + } + + module.exports = makeIterator; + + + +},{"../object/deepMatches":53,"./identity":41,"./prop":43}],43:[function(require,module,exports){ + + + /** + * Returns a function that gets a property of the passed object + */ + function prop(name){ + return function(obj){ + return obj[name]; + }; + } + + module.exports = prop; + + + +},{}],44:[function(require,module,exports){ +var slice = require('../array/slice'); + + /** + * Delays the call of a function within a given context. + */ + function timeout(fn, millis, context){ + + var args = slice(arguments, 3); + + return setTimeout(function() { + fn.apply(context, args); + }, millis); + } + + module.exports = timeout; + + + +},{"../array/slice":39}],45:[function(require,module,exports){ +var isKind = require('./isKind'); + /** + */ + var isArray = Array.isArray || function (val) { + return isKind(val, 'Array'); + }; + module.exports = isArray; + + +},{"./isKind":46}],46:[function(require,module,exports){ +var kindOf = require('./kindOf'); + /** + * Check if value is from a specific "kind". + */ + function isKind(val, kind){ + return kindOf(val) === kind; + } + module.exports = isKind; + + +},{"./kindOf":47}],47:[function(require,module,exports){ + + /** + * Gets the "kind" of value. (e.g. "String", "Number", etc) + */ + function kindOf(val) { + return Object.prototype.toString.call(val).slice(8, -1); + } + module.exports = kindOf; + + +},{}],48:[function(require,module,exports){ + + + /** + * Typecast a value to a String, using an empty string value for null or + * undefined. + */ + function toString(val){ + return val == null ? '' : val.toString(); + } + + module.exports = toString; + + + +},{}],49:[function(require,module,exports){ + + /** + * Clamps value inside range. + */ + function clamp(val, min, max){ + return val < min? min : (val > max? max : val); + } + module.exports = clamp; + + +},{}],50:[function(require,module,exports){ + + /** + * Linear interpolation. + * IMPORTANT:will return `Infinity` if numbers overflow Number.MAX_VALUE + */ + function lerp(ratio, start, end){ + return start + (end - start) * ratio; + } + + module.exports = lerp; + + +},{}],51:[function(require,module,exports){ +var lerp = require('./lerp'); +var norm = require('./norm'); + /** + * Maps a number from one scale to another. + * @example map(3, 0, 4, -1, 1) -> 0.5 + */ + function map(val, min1, max1, min2, max2){ + return lerp( norm(val, min1, max1), min2, max2 ); + } + module.exports = map; + + +},{"./lerp":50,"./norm":52}],52:[function(require,module,exports){ + + /** + * Gets normalized ratio of value inside range. + */ + function norm(val, min, max){ + if (val < min || val > max) { + throw new RangeError('value (' + val + ') must be between ' + min + ' and ' + max); + } + + return val === max ? 1 : (val - min) / (max - min); + } + module.exports = norm; + + +},{}],53:[function(require,module,exports){ +var forOwn = require('./forOwn'); +var isArray = require('../lang/isArray'); + + function containsMatch(array, pattern) { + var i = -1, length = array.length; + while (++i < length) { + if (deepMatches(array[i], pattern)) { + return true; + } + } + + return false; + } + + function matchArray(target, pattern) { + var i = -1, patternLength = pattern.length; + while (++i < patternLength) { + if (!containsMatch(target, pattern[i])) { + return false; + } + } + + return true; + } + + function matchObject(target, pattern) { + var result = true; + forOwn(pattern, function(val, key) { + if (!deepMatches(target[key], val)) { + // Return false to break out of forOwn early + return (result = false); + } + }); + + return result; + } + + /** + * Recursively check if the objects match. + */ + function deepMatches(target, pattern){ + if (target && typeof target === 'object' && + pattern && typeof pattern === 'object') { + if (isArray(target) && isArray(pattern)) { + return matchArray(target, pattern); + } else { + return matchObject(target, pattern); + } + } else { + return target === pattern; + } + } + + module.exports = deepMatches; + + + +},{"../lang/isArray":45,"./forOwn":55}],54:[function(require,module,exports){ +var hasOwn = require('./hasOwn'); + + var _hasDontEnumBug, + _dontEnums; + + function checkDontEnum(){ + _dontEnums = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' + ]; + + _hasDontEnumBug = true; + + for (var key in {'toString': null}) { + _hasDontEnumBug = false; + } + } + + /** + * Similar to Array/forEach but works over object properties and fixes Don't + * Enum bug on IE. + * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation + */ + function forIn(obj, fn, thisObj){ + var key, i = 0; + // no need to check if argument is a real object that way we can use + // it for arrays, functions, date, etc. + + //post-pone check till needed + if (_hasDontEnumBug == null) checkDontEnum(); + + for (key in obj) { + if (exec(fn, obj, key, thisObj) === false) { + break; + } + } + + + if (_hasDontEnumBug) { + var ctor = obj.constructor, + isProto = !!ctor && obj === ctor.prototype; + + while (key = _dontEnums[i++]) { + // For constructor, if it is a prototype object the constructor + // is always non-enumerable unless defined otherwise (and + // enumerated above). For non-prototype objects, it will have + // to be defined on this object, since it cannot be defined on + // any prototype objects. + // + // For other [[DontEnum]] properties, check if the value is + // different than Object prototype value. + if ( + (key !== 'constructor' || + (!isProto && hasOwn(obj, key))) && + obj[key] !== Object.prototype[key] + ) { + if (exec(fn, obj, key, thisObj) === false) { + break; + } + } + } + } + } + + function exec(fn, obj, key, thisObj){ + return fn.call(thisObj, obj[key], key, obj); + } + + module.exports = forIn; + + + +},{"./hasOwn":56}],55:[function(require,module,exports){ +var hasOwn = require('./hasOwn'); +var forIn = require('./forIn'); + + /** + * Similar to Array/forEach but works over object properties and fixes Don't + * Enum bug on IE. + * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation + */ + function forOwn(obj, fn, thisObj){ + forIn(obj, function(val, key){ + if (hasOwn(obj, key)) { + return fn.call(thisObj, obj[key], key, obj); + } + }); + } + + module.exports = forOwn; + + + +},{"./forIn":54,"./hasOwn":56}],56:[function(require,module,exports){ + + + /** + * Safer Object.hasOwnProperty + */ + function hasOwn(obj, prop){ + return Object.prototype.hasOwnProperty.call(obj, prop); + } + + module.exports = hasOwn; + + + +},{}],57:[function(require,module,exports){ + + /** + * Contains all Unicode white-spaces. Taken from + * http://en.wikipedia.org/wiki/Whitespace_character. + */ + module.exports = [ + ' ', '\n', '\r', '\t', '\f', '\v', '\u00A0', '\u1680', '\u180E', + '\u2000', '\u2001', '\u2002', '\u2003', '\u2004', '\u2005', '\u2006', + '\u2007', '\u2008', '\u2009', '\u200A', '\u2028', '\u2029', '\u202F', + '\u205F', '\u3000' + ]; + + +},{}],58:[function(require,module,exports){ +var toString = require('../lang/toString'); +var WHITE_SPACES = require('./WHITE_SPACES'); + /** + * Remove chars from beginning of string. + */ + function ltrim(str, chars) { + str = toString(str); + chars = chars || WHITE_SPACES; + + var start = 0, + len = str.length, + charLen = chars.length, + found = true, + i, c; + + while (found && start < len) { + found = false; + i = -1; + c = str.charAt(start); + + while (++i < charLen) { + if (c === chars[i]) { + found = true; + start++; + break; + } + } + } + + return (start >= len) ? '' : str.substr(start, len); + } + + module.exports = ltrim; + + +},{"../lang/toString":48,"./WHITE_SPACES":57}],59:[function(require,module,exports){ +var toString = require('../lang/toString'); +var WHITE_SPACES = require('./WHITE_SPACES'); + /** + * Remove chars from end of string. + */ + function rtrim(str, chars) { + str = toString(str); + chars = chars || WHITE_SPACES; + + var end = str.length - 1, + charLen = chars.length, + found = true, + i, c; + + while (found && end >= 0) { + found = false; + i = -1; + c = str.charAt(end); + + while (++i < charLen) { + if (c === chars[i]) { + found = true; + end--; + break; + } + } + } + + return (end >= 0) ? str.substring(0, end + 1) : ''; + } + + module.exports = rtrim; + + +},{"../lang/toString":48,"./WHITE_SPACES":57}],60:[function(require,module,exports){ +var toString = require('../lang/toString'); +var WHITE_SPACES = require('./WHITE_SPACES'); +var ltrim = require('./ltrim'); +var rtrim = require('./rtrim'); + /** + * Remove white-spaces from beginning and end of string. + */ + function trim(str, chars) { + str = toString(str); + chars = chars || WHITE_SPACES; + return ltrim(rtrim(str, chars), chars); + } + + module.exports = trim; + + +},{"../lang/toString":48,"./WHITE_SPACES":57,"./ltrim":58,"./rtrim":59}],61:[function(require,module,exports){ + + + /** + * Create slice of source array or array-like object + */ + function slice(arr, start, end){ + var len = arr.length; + + if (start == null) { + start = 0; + } else if (start < 0) { + start = Math.max(len + start, 0); + } else { + start = Math.min(start, len); + } + + if (end == null) { + end = len; + } else if (end < 0) { + end = Math.max(len + end, 0); + } else { + end = Math.min(end, len); + } + + var result = []; + while (start < end) { + result.push(arr[start++]); + } + + return result; + } + + module.exports = slice; + + + +},{}],62:[function(require,module,exports){ +var slice = require('../array/slice'); + + /** + * Return a function that will execute in the given context, optionally adding any additional supplied parameters to the beginning of the arguments collection. + * @param {Function} fn Function. + * @param {object} context Execution context. + * @param {rest} args Arguments (0...n arguments). + * @return {Function} Wrapped Function. + */ + function bind(fn, context, args){ + var argsArr = slice(arguments, 2); //curried args + return function(){ + return fn.apply(context, argsArr.concat(slice(arguments))); + }; + } + + module.exports = bind; + + + +},{"../array/slice":61}],63:[function(require,module,exports){ +var kindOf = require('./kindOf'); +var isPlainObject = require('./isPlainObject'); +var mixIn = require('../object/mixIn'); + + /** + * Clone native types. + */ + function clone(val){ + switch (kindOf(val)) { + case 'Object': + return cloneObject(val); + case 'Array': + return cloneArray(val); + case 'RegExp': + return cloneRegExp(val); + case 'Date': + return cloneDate(val); + default: + return val; + } + } + + function cloneObject(source) { + if (isPlainObject(source)) { + return mixIn({}, source); + } else { + return source; + } + } + + function cloneRegExp(r) { + var flags = ''; + flags += r.multiline ? 'm' : ''; + flags += r.global ? 'g' : ''; + flags += r.ignorecase ? 'i' : ''; + return new RegExp(r.source, flags); + } + + function cloneDate(date) { + return new Date(+date); + } + + function cloneArray(arr) { + return arr.slice(); + } + + module.exports = clone; + + + +},{"../object/mixIn":73,"./isPlainObject":67,"./kindOf":68}],64:[function(require,module,exports){ +var clone = require('./clone'); +var forOwn = require('../object/forOwn'); +var kindOf = require('./kindOf'); +var isPlainObject = require('./isPlainObject'); + + /** + * Recursively clone native types. + */ + function deepClone(val, instanceClone) { + switch ( kindOf(val) ) { + case 'Object': + return cloneObject(val, instanceClone); + case 'Array': + return cloneArray(val, instanceClone); + default: + return clone(val); + } + } + + function cloneObject(source, instanceClone) { + if (isPlainObject(source)) { + var out = {}; + forOwn(source, function(val, key) { + this[key] = deepClone(val, instanceClone); + }, out); + return out; + } else if (instanceClone) { + return instanceClone(source); + } else { + return source; + } + } + + function cloneArray(arr, instanceClone) { + var out = [], + i = -1, + n = arr.length, + val; + while (++i < n) { + out[i] = deepClone(arr[i], instanceClone); + } + return out; + } + + module.exports = deepClone; + + + + +},{"../object/forOwn":70,"./clone":63,"./isPlainObject":67,"./kindOf":68}],65:[function(require,module,exports){ +arguments[4][24][0].apply(exports,arguments) +},{"./kindOf":68,"dup":24}],66:[function(require,module,exports){ +var isKind = require('./isKind'); + /** + */ + function isObject(val) { + return isKind(val, 'Object'); + } + module.exports = isObject; + + +},{"./isKind":65}],67:[function(require,module,exports){ + + + /** + * Checks if the value is created by the `Object` constructor. + */ + function isPlainObject(value) { + return (!!value && typeof value === 'object' && + value.constructor === Object); + } + + module.exports = isPlainObject; + + + +},{}],68:[function(require,module,exports){ +arguments[4][25][0].apply(exports,arguments) +},{"dup":25}],69:[function(require,module,exports){ +arguments[4][28][0].apply(exports,arguments) +},{"./hasOwn":71,"dup":28}],70:[function(require,module,exports){ +arguments[4][29][0].apply(exports,arguments) +},{"./forIn":69,"./hasOwn":71,"dup":29}],71:[function(require,module,exports){ +arguments[4][30][0].apply(exports,arguments) +},{"dup":30}],72:[function(require,module,exports){ +var hasOwn = require('./hasOwn'); +var deepClone = require('../lang/deepClone'); +var isObject = require('../lang/isObject'); + + /** + * Deep merge objects. + */ + function merge() { + var i = 1, + key, val, obj, target; + + // make sure we don't modify source element and it's properties + // objects are passed by reference + target = deepClone( arguments[0] ); + + while (obj = arguments[i++]) { + for (key in obj) { + if ( ! hasOwn(obj, key) ) { + continue; + } + + val = obj[key]; + + if ( isObject(val) && isObject(target[key]) ){ + // inception, deep merge objects + target[key] = merge(target[key], val); + } else { + // make sure arrays, regexp, date, objects are cloned + target[key] = deepClone(val); + } + + } + } + + return target; + } + + module.exports = merge; + + + +},{"../lang/deepClone":64,"../lang/isObject":66,"./hasOwn":71}],73:[function(require,module,exports){ +var forOwn = require('./forOwn'); + + /** + * Combine properties from all the objects into first one. + * - This method affects target object in place, if you want to create a new Object pass an empty object as first param. + * @param {object} target Target Object + * @param {...object} objects Objects to be combined (0...n objects). + * @return {object} Target Object. + */ + function mixIn(target, objects){ + var i = 0, + n = arguments.length, + obj; + while(++i < n){ + obj = arguments[i]; + if (obj != null) { + forOwn(obj, copyProp, target); + } + } + return target; + } + + function copyProp(val, key){ + this[key] = val; + } + + module.exports = mixIn; + + +},{"./forOwn":70}],74:[function(require,module,exports){ +/* +prime + - prototypal inheritance +*/"use strict" + +var hasOwn = require("mout/object/hasOwn"), + mixIn = require("mout/object/mixIn"), + create = require("mout/lang/createObject"), + kindOf = require("mout/lang/kindOf") + +var hasDescriptors = true + +try { + Object.defineProperty({}, "~", {}) + Object.getOwnPropertyDescriptor({}, "~") +} catch (e){ + hasDescriptors = false +} + +// we only need to be able to implement "toString" and "valueOf" in IE < 9 +var hasEnumBug = !({valueOf: 0}).propertyIsEnumerable("valueOf"), + buggy = ["toString", "valueOf"] + +var verbs = /^constructor|inherits|mixin$/ + +var implement = function(proto){ + var prototype = this.prototype + + for (var key in proto){ + if (key.match(verbs)) continue + if (hasDescriptors){ + var descriptor = Object.getOwnPropertyDescriptor(proto, key) + if (descriptor){ + Object.defineProperty(prototype, key, descriptor) + continue + } + } + prototype[key] = proto[key] + } + + if (hasEnumBug) for (var i = 0; (key = buggy[i]); i++){ + var value = proto[key] + if (value !== Object.prototype[key]) prototype[key] = value + } + + return this +} + +var prime = function(proto){ + + if (kindOf(proto) === "Function") proto = {constructor: proto} + + var superprime = proto.inherits + + // if our nice proto object has no own constructor property + // then we proceed using a ghosting constructor that all it does is + // call the parent's constructor if it has a superprime, else an empty constructor + // proto.constructor becomes the effective constructor + var constructor = (hasOwn(proto, "constructor")) ? proto.constructor : (superprime) ? function(){ + return superprime.apply(this, arguments) + } : function(){} + + if (superprime){ + + mixIn(constructor, superprime) + + var superproto = superprime.prototype + // inherit from superprime + var cproto = constructor.prototype = create(superproto) + + // setting constructor.parent to superprime.prototype + // because it's the shortest possible absolute reference + constructor.parent = superproto + cproto.constructor = constructor + } + + if (!constructor.implement) constructor.implement = implement + + var mixins = proto.mixin + if (mixins){ + if (kindOf(mixins) !== "Array") mixins = [mixins] + for (var i = 0; i < mixins.length; i++) constructor.implement(create(mixins[i].prototype)) + } + + // implement proto and return constructor + return constructor.implement(proto) + +} + +module.exports = prime + +},{"mout/lang/createObject":75,"mout/lang/kindOf":76,"mout/object/hasOwn":79,"mout/object/mixIn":80}],75:[function(require,module,exports){ +var mixIn = require('../object/mixIn'); + + /** + * Create Object using prototypal inheritance and setting custom properties. + * - Mix between Douglas Crockford Prototypal Inheritance and the EcmaScript 5 `Object.create()` method. + * @param {object} parent Parent Object. + * @param {object} [props] Object properties. + * @return {object} Created object. + */ + function createObject(parent, props){ + function F(){} + F.prototype = parent; + return mixIn(new F(), props); + + } + module.exports = createObject; + + + +},{"../object/mixIn":80}],76:[function(require,module,exports){ +arguments[4][25][0].apply(exports,arguments) +},{"dup":25}],77:[function(require,module,exports){ +arguments[4][28][0].apply(exports,arguments) +},{"./hasOwn":79,"dup":28}],78:[function(require,module,exports){ +arguments[4][29][0].apply(exports,arguments) +},{"./forIn":77,"./hasOwn":79,"dup":29}],79:[function(require,module,exports){ +arguments[4][30][0].apply(exports,arguments) +},{"dup":30}],80:[function(require,module,exports){ +arguments[4][73][0].apply(exports,arguments) +},{"./forOwn":78,"dup":73}],81:[function(require,module,exports){ +"use strict"; + +// credits to @cpojer's Class.Binds, released under the MIT license +// https://github.com/cpojer/mootools-class-extras/blob/master/Source/Class.Binds.js + +var prime = require("prime") +var bind = require("mout/function/bind") + +var bound = prime({ + + bound: function(name){ + var bound = this._bound || (this._bound = {}) + return bound[name] || (bound[name] = bind(this[name], this)) + } + +}) + +module.exports = bound + +},{"mout/function/bind":62,"prime":74}],82:[function(require,module,exports){ +"use strict"; + +var prime = require("prime") +var merge = require("mout/object/merge") + +var Options = prime({ + + setOptions: function(options){ + var args = [{}, this.options] + args.push.apply(args, arguments) + this.options = merge.apply(null, args) + return this + } + +}) + +module.exports = Options + +},{"mout/object/merge":72,"prime":74}],83:[function(require,module,exports){ +(function (process,global,setImmediate){(function (){ +/* +defer +*/"use strict" + +var kindOf = require("mout/lang/kindOf"), + now = require("mout/time/now"), + forEach = require("mout/array/forEach"), + indexOf = require("mout/array/indexOf") + +var callbacks = { + timeout: {}, + frame: [], + immediate: [] +} + +var push = function(collection, callback, context, defer){ + + var iterator = function(){ + iterate(collection) + } + + if (!collection.length) defer(iterator) + + var entry = { + callback: callback, + context: context + } + + collection.push(entry) + + return function(){ + var io = indexOf(collection, entry) + if (io > -1) collection.splice(io, 1) + } +} + +var iterate = function(collection){ + var time = now() + + forEach(collection.splice(0), function(entry) { + entry.callback.call(entry.context, time) + }) +} + +var defer = function(callback, argument, context){ + return (kindOf(argument) === "Number") ? defer.timeout(callback, argument, context) : defer.immediate(callback, argument) +} + +if (global.process && process.nextTick){ + + defer.immediate = function(callback, context){ + return push(callbacks.immediate, callback, context, process.nextTick) + } + +} else if (global.setImmediate){ + + defer.immediate = function(callback, context){ + return push(callbacks.immediate, callback, context, setImmediate) + } + +} else if (global.postMessage && global.addEventListener){ + + addEventListener("message", function(event){ + if (event.source === global && event.data === "@deferred"){ + event.stopPropagation() + iterate(callbacks.immediate) + } + }, true) + + defer.immediate = function(callback, context){ + return push(callbacks.immediate, callback, context, function(){ + postMessage("@deferred", "*") + }) + } + +} else { + + defer.immediate = function(callback, context){ + return push(callbacks.immediate, callback, context, function(iterator){ + setTimeout(iterator, 0) + }) + } + +} + +var requestAnimationFrame = global.requestAnimationFrame || + global.webkitRequestAnimationFrame || + global.mozRequestAnimationFrame || + global.oRequestAnimationFrame || + global.msRequestAnimationFrame || + function(callback) { + setTimeout(callback, 1e3 / 60) + } + +defer.frame = function(callback, context){ + return push(callbacks.frame, callback, context, requestAnimationFrame) +} + +var clear + +defer.timeout = function(callback, ms, context){ + var ct = callbacks.timeout + + if (!clear) clear = defer.immediate(function(){ + clear = null + callbacks.timeout = {} + }) + + return push(ct[ms] || (ct[ms] = []), callback, context, function(iterator){ + setTimeout(iterator, ms) + }) +} + +module.exports = defer + +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate) + +},{"_process":99,"mout/array/forEach":87,"mout/array/indexOf":88,"mout/lang/kindOf":90,"mout/time/now":95,"timers":100}],84:[function(require,module,exports){ +/* +Emitter +*/"use strict" + +var indexOf = require("mout/array/indexOf"), + forEach = require("mout/array/forEach") + +var prime = require("./index"), + defer = require("./defer") + +var slice = Array.prototype.slice; + +var Emitter = prime({ + + constructor: function(stoppable){ + this._stoppable = stoppable + }, + + on: function(event, fn){ + var listeners = this._listeners || (this._listeners = {}), + events = listeners[event] || (listeners[event] = []) + + if (indexOf(events, fn) === -1) events.push(fn) + + return this + }, + + off: function(event, fn){ + var listeners = this._listeners, events + if (listeners && (events = listeners[event])){ + + var io = indexOf(events, fn) + if (io > -1) events.splice(io, 1) + if (!events.length) delete listeners[event]; + for (var l in listeners) return this + delete this._listeners + } + return this + }, + + emit: function(event){ + var self = this, + args = slice.call(arguments, 1) + + var emit = function(){ + var listeners = self._listeners, events + if (listeners && (events = listeners[event])){ + forEach(events.slice(0), function(event){ + var result = event.apply(self, args) + if (self._stoppable) return result + }) + } + } + + if (args[args.length - 1] === Emitter.EMIT_SYNC){ + args.pop() + emit() + } else { + defer(emit) + } + + return this + } + +}) + +Emitter.EMIT_SYNC = {} + +module.exports = Emitter + +},{"./defer":83,"./index":85,"mout/array/forEach":87,"mout/array/indexOf":88}],85:[function(require,module,exports){ +/* +prime + - prototypal inheritance +*/"use strict" + +var hasOwn = require("mout/object/hasOwn"), + mixIn = require("mout/object/mixIn"), + create = require("mout/lang/createObject"), + kindOf = require("mout/lang/kindOf") + +var hasDescriptors = true + +try { + Object.defineProperty({}, "~", {}) + Object.getOwnPropertyDescriptor({}, "~") +} catch (e){ + hasDescriptors = false +} + +// we only need to be able to implement "toString" and "valueOf" in IE < 9 +var hasEnumBug = !({valueOf: 0}).propertyIsEnumerable("valueOf"), + buggy = ["toString", "valueOf"] + +var verbs = /^constructor|inherits|mixin$/ + +var implement = function(proto){ + var prototype = this.prototype + + for (var key in proto){ + if (key.match(verbs)) continue + if (hasDescriptors){ + var descriptor = Object.getOwnPropertyDescriptor(proto, key) + if (descriptor){ + Object.defineProperty(prototype, key, descriptor) + continue + } + } + prototype[key] = proto[key] + } + + if (hasEnumBug) for (var i = 0; (key = buggy[i]); i++){ + var value = proto[key] + if (value !== Object.prototype[key]) prototype[key] = value + } + + return this +} + +var prime = function(proto){ + + if (kindOf(proto) === "Function") proto = {constructor: proto} + + var superprime = proto.inherits + + // if our nice proto object has no own constructor property + // then we proceed using a ghosting constructor that all it does is + // call the parent's constructor if it has a superprime, else an empty constructor + // proto.constructor becomes the effective constructor + var constructor = (hasOwn(proto, "constructor")) ? proto.constructor : (superprime) ? function(){ + return superprime.apply(this, arguments) + } : function(){} + + if (superprime){ + + mixIn(constructor, superprime) + + var superproto = superprime.prototype + // inherit from superprime + var cproto = constructor.prototype = create(superproto) + + // setting constructor.parent to superprime.prototype + // because it's the shortest possible absolute reference + constructor.parent = superproto + cproto.constructor = constructor + } + + if (!constructor.implement) constructor.implement = implement + + var mixins = proto.mixin + if (mixins){ + if (kindOf(mixins) !== "Array") mixins = [mixins] + for (var i = 0; i < mixins.length; i++) constructor.implement(create(mixins[i].prototype)) + } + + // implement proto and return constructor + return constructor.implement(proto) + +} + +module.exports = prime + +},{"mout/lang/createObject":89,"mout/lang/kindOf":90,"mout/object/hasOwn":93,"mout/object/mixIn":94}],86:[function(require,module,exports){ +/* +Map +*/"use strict" + +var indexOf = require("mout/array/indexOf") + +var prime = require("./index") + +var Map = prime({ + + constructor: function Map(){ + this.length = 0 + this._values = [] + this._keys = [] + }, + + set: function(key, value){ + var index = indexOf(this._keys, key) + + if (index === -1){ + this._keys.push(key) + this._values.push(value) + this.length++ + } else { + this._values[index] = value + } + + return this + }, + + get: function(key){ + var index = indexOf(this._keys, key) + return (index === -1) ? null : this._values[index] + }, + + count: function(){ + return this.length + }, + + forEach: function(method, context){ + for (var i = 0, l = this.length; i < l; i++){ + if (method.call(context, this._values[i], this._keys[i], this) === false) break + } + return this + }, + + map: function(method, context){ + var results = new Map + this.forEach(function(value, key){ + results.set(key, method.call(context, value, key, this)) + }, this) + return results + }, + + filter: function(method, context){ + var results = new Map + this.forEach(function(value, key){ + if (method.call(context, value, key, this)) results.set(key, value) + }, this) + return results + }, + + every: function(method, context){ + var every = true + this.forEach(function(value, key){ + if (!method.call(context, value, key, this)) return (every = false) + }, this) + return every + }, + + some: function(method, context){ + var some = false + this.forEach(function(value, key){ + if (method.call(context, value, key, this)) return !(some = true) + }, this) + return some + }, + + indexOf: function(value){ + var index = indexOf(this._values, value) + return (index > -1) ? this._keys[index] : null + }, + + remove: function(value){ + var index = indexOf(this._values, value) + + if (index !== -1){ + this._values.splice(index, 1) + this.length-- + return this._keys.splice(index, 1)[0] + } + + return null + }, + + unset: function(key){ + var index = indexOf(this._keys, key) + + if (index !== -1){ + this._keys.splice(index, 1) + this.length-- + return this._values.splice(index, 1)[0] + } + + return null + }, + + keys: function(){ + return this._keys.slice() + }, + + values: function(){ + return this._values.slice() + } + +}) + +var map = function(){ + return new Map +} + +map.prototype = Map.prototype + +module.exports = map + +},{"./index":85,"mout/array/indexOf":88}],87:[function(require,module,exports){ +arguments[4][16][0].apply(exports,arguments) +},{"dup":16}],88:[function(require,module,exports){ +arguments[4][17][0].apply(exports,arguments) +},{"dup":17}],89:[function(require,module,exports){ +arguments[4][75][0].apply(exports,arguments) +},{"../object/mixIn":94,"dup":75}],90:[function(require,module,exports){ +arguments[4][25][0].apply(exports,arguments) +},{"dup":25}],91:[function(require,module,exports){ +arguments[4][28][0].apply(exports,arguments) +},{"./hasOwn":93,"dup":28}],92:[function(require,module,exports){ +arguments[4][29][0].apply(exports,arguments) +},{"./forIn":91,"./hasOwn":93,"dup":29}],93:[function(require,module,exports){ +arguments[4][30][0].apply(exports,arguments) +},{"dup":30}],94:[function(require,module,exports){ +arguments[4][73][0].apply(exports,arguments) +},{"./forOwn":92,"dup":73}],95:[function(require,module,exports){ + + + /** + * Get current time in miliseconds + */ + function now(){ + // yes, we defer the work to another function to allow mocking it + // during the tests + return now.get(); + } + + now.get = (typeof Date.now === 'function')? Date.now : function(){ + return +(new Date()); + }; + + module.exports = now; + + + +},{}],96:[function(require,module,exports){ +/* +Slick Finder +*/"use strict" + +// Notable changes from Slick.Finder 1.0.x + +// faster bottom -> up expression matching +// prefers mental sanity over *obsessive compulsive* milliseconds savings +// uses prototypes instead of objects +// tries to use matchesSelector smartly, whenever available +// can populate objects as well as arrays +// lots of stuff is broken or not implemented + +var parse = require("./parser") + +// utilities + +var index = 0, + counter = document.__counter = (parseInt(document.__counter || -1, 36) + 1).toString(36), + key = "uid:" + counter + +var uniqueID = function(n, xml){ + if (n === window) return "window" + if (n === document) return "document" + if (n === document.documentElement) return "html" + + if (xml) { + var uid = n.getAttribute(key) + if (!uid) { + uid = (index++).toString(36) + n.setAttribute(key, uid) + } + return uid + } else { + return n[key] || (n[key] = (index++).toString(36)) + } +} + +var uniqueIDXML = function(n) { + return uniqueID(n, true) +} + +var isArray = Array.isArray || function(object){ + return Object.prototype.toString.call(object) === "[object Array]" +} + +// tests + +var uniqueIndex = 0; + +var HAS = { + + GET_ELEMENT_BY_ID: function(test, id){ + id = "slick_" + (uniqueIndex++); + // checks if the document has getElementById, and it works + test.innerHTML = '' + return !!this.getElementById(id) + }, + + QUERY_SELECTOR: function(test){ + // this supposedly fixes a webkit bug with matchesSelector / querySelector & nth-child + test.innerHTML = '_' + + // checks if the document has querySelectorAll, and it works + test.innerHTML = '' + + return test.querySelectorAll('.MiX').length === 1 + }, + + EXPANDOS: function(test, id){ + id = "slick_" + (uniqueIndex++); + // checks if the document has elements that support expandos + test._custom_property_ = id + return test._custom_property_ === id + }, + + // TODO: use this ? + + // CHECKED_QUERY_SELECTOR: function(test){ + // + // // checks if the document supports the checked query selector + // test.innerHTML = '' + // return test.querySelectorAll(':checked').length === 1 + // }, + + // TODO: use this ? + + // EMPTY_ATTRIBUTE_QUERY_SELECTOR: function(test){ + // + // // checks if the document supports the empty attribute query selector + // test.innerHTML = '' + // return test.querySelectorAll('[class*=""]').length === 1 + // }, + + MATCHES_SELECTOR: function(test){ + + test.className = "MiX" + + // checks if the document has matchesSelector, and we can use it. + + var matches = test.matchesSelector || test.mozMatchesSelector || test.webkitMatchesSelector + + // if matchesSelector trows errors on incorrect syntax we can use it + if (matches) try { + matches.call(test, ':slick') + } catch(e){ + // just as a safety precaution, also test if it works on mixedcase (like querySelectorAll) + return matches.call(test, ".MiX") ? matches : false + } + + return false + }, + + GET_ELEMENTS_BY_CLASS_NAME: function(test){ + test.innerHTML = '' + if (test.getElementsByClassName('b').length !== 1) return false + + test.firstChild.className = 'b' + if (test.getElementsByClassName('b').length !== 2) return false + + // Opera 9.6 getElementsByClassName doesnt detects the class if its not the first one + test.innerHTML = '' + if (test.getElementsByClassName('a').length !== 2) return false + + // tests passed + return true + }, + + // no need to know + + // GET_ELEMENT_BY_ID_NOT_NAME: function(test, id){ + // test.innerHTML = '' + // return this.getElementById(id) !== test.firstChild + // }, + + // this is always checked for and fixed + + // STAR_GET_ELEMENTS_BY_TAG_NAME: function(test){ + // + // // IE returns comment nodes for getElementsByTagName('*') for some documents + // test.appendChild(this.createComment('')) + // if (test.getElementsByTagName('*').length > 0) return false + // + // // IE returns closed nodes (EG:"") for getElementsByTagName('*') for some documents + // test.innerHTML = 'foo' + // if (test.getElementsByTagName('*').length) return false + // + // // tests passed + // return true + // }, + + // this is always checked for and fixed + + // STAR_QUERY_SELECTOR: function(test){ + // + // // returns closed nodes (EG:"") for querySelector('*') for some documents + // test.innerHTML = 'foo' + // return !!(test.querySelectorAll('*').length) + // }, + + GET_ATTRIBUTE: function(test){ + // tests for working getAttribute implementation + var shout = "fus ro dah" + test.innerHTML = '' + return test.firstChild.getAttribute('class') === shout + } + +} + +// Finder + +var Finder = function Finder(document){ + + this.document = document + var root = this.root = document.documentElement + this.tested = {} + + // uniqueID + + this.uniqueID = this.has("EXPANDOS") ? uniqueID : uniqueIDXML + + // getAttribute + + this.getAttribute = (this.has("GET_ATTRIBUTE")) ? function(node, name){ + + return node.getAttribute(name) + + } : function(node, name){ + + node = node.getAttributeNode(name) + return (node && node.specified) ? node.value : null + + } + + // hasAttribute + + this.hasAttribute = (root.hasAttribute) ? function(node, attribute){ + + return node.hasAttribute(attribute) + + } : function(node, attribute) { + + node = node.getAttributeNode(attribute) + return !!(node && node.specified) + + } + + // contains + + this.contains = (document.contains && root.contains) ? function(context, node){ + + return context.contains(node) + + } : (root.compareDocumentPosition) ? function(context, node){ + + return context === node || !!(context.compareDocumentPosition(node) & 16) + + } : function(context, node){ + + do { + if (node === context) return true + } while ((node = node.parentNode)) + + return false + } + + // sort + // credits to Sizzle (http://sizzlejs.com/) + + this.sorter = (root.compareDocumentPosition) ? function(a, b){ + + if (!a.compareDocumentPosition || !b.compareDocumentPosition) return 0 + return a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1 + + } : ('sourceIndex' in root) ? function(a, b){ + + if (!a.sourceIndex || !b.sourceIndex) return 0 + return a.sourceIndex - b.sourceIndex + + } : (document.createRange) ? function(a, b){ + + if (!a.ownerDocument || !b.ownerDocument) return 0 + var aRange = a.ownerDocument.createRange(), + bRange = b.ownerDocument.createRange() + + aRange.setStart(a, 0) + aRange.setEnd(a, 0) + bRange.setStart(b, 0) + bRange.setEnd(b, 0) + return aRange.compareBoundaryPoints(Range.START_TO_END, bRange) + + } : null + + this.failed = {} + + var nativeMatches = this.has("MATCHES_SELECTOR") + + if (nativeMatches) this.matchesSelector = function(node, expression){ + + if (this.failed[expression]) return null + + try { + return nativeMatches.call(node, expression) + } catch(e){ + if (slick.debug) console.warn("matchesSelector failed on " + expression) + this.failed[expression] = true + return null + } + + } + + if (this.has("QUERY_SELECTOR")){ + + this.querySelectorAll = function(node, expression){ + + if (this.failed[expression]) return true + + var result, _id, _expression, _combinator, _node + + + // non-document rooted QSA + // credits to Andrew Dupont + + if (node !== this.document){ + + _combinator = expression[0].combinator + + _id = node.getAttribute("id") + _expression = expression + + if (!_id){ + _node = node + _id = "__slick__" + _node.setAttribute("id", _id) + } + + expression = "#" + _id + " " + _expression + + + // these combinators need a parentNode due to how querySelectorAll works, which is: + // finding all the elements that match the given selector + // then filtering by the ones that have the specified element as an ancestor + if (_combinator.indexOf("~") > -1 || _combinator.indexOf("+") > -1){ + + node = node.parentNode + if (!node) result = true + // if node has no parentNode, we return "true" as if it failed, without polluting the failed cache + + } + + } + + if (!result) try { + result = node.querySelectorAll(expression.toString()) + } catch(e){ + if (slick.debug) console.warn("querySelectorAll failed on " + (_expression || expression)) + result = this.failed[_expression || expression] = true + } + + if (_node) _node.removeAttribute("id") + + return result + + } + + } + +} + +Finder.prototype.has = function(FEATURE){ + + var tested = this.tested, + testedFEATURE = tested[FEATURE] + + if (testedFEATURE != null) return testedFEATURE + + var root = this.root, + document = this.document, + testNode = document.createElement("div") + + testNode.setAttribute("style", "display: none;") + + root.appendChild(testNode) + + var TEST = HAS[FEATURE], result = false + + if (TEST) try { + result = TEST.call(document, testNode) + } catch(e){} + + if (slick.debug && !result) console.warn("document has no " + FEATURE) + + root.removeChild(testNode) + + return tested[FEATURE] = result + +} + +var combinators = { + + " ": function(node, part, push){ + + var item, items + + var noId = !part.id, noTag = !part.tag, noClass = !part.classes + + if (part.id && node.getElementById && this.has("GET_ELEMENT_BY_ID")){ + item = node.getElementById(part.id) + + // return only if id is found, else keep checking + // might be a tad slower on non-existing ids, but less insane + + if (item && item.getAttribute('id') === part.id){ + items = [item] + noId = true + // if tag is star, no need to check it in match() + if (part.tag === "*") noTag = true + } + } + + if (!items){ + + if (part.classes && node.getElementsByClassName && this.has("GET_ELEMENTS_BY_CLASS_NAME")){ + items = node.getElementsByClassName(part.classList) + noClass = true + // if tag is star, no need to check it in match() + if (part.tag === "*") noTag = true + } else { + items = node.getElementsByTagName(part.tag) + // if tag is star, need to check it in match because it could select junk, boho + if (part.tag !== "*") noTag = true + } + + if (!items || !items.length) return false + + } + + for (var i = 0; item = items[i++];) + if ((noTag && noId && noClass && !part.attributes && !part.pseudos) || this.match(item, part, noTag, noId, noClass)) + push(item) + + return true + + }, + + ">": function(node, part, push){ // direct children + if ((node = node.firstChild)) do { + if (node.nodeType == 1 && this.match(node, part)) push(node) + } while ((node = node.nextSibling)) + }, + + "+": function(node, part, push){ // next sibling + while ((node = node.nextSibling)) if (node.nodeType == 1){ + if (this.match(node, part)) push(node) + break + } + }, + + "^": function(node, part, push){ // first child + node = node.firstChild + if (node){ + if (node.nodeType === 1){ + if (this.match(node, part)) push(node) + } else { + combinators['+'].call(this, node, part, push) + } + } + }, + + "~": function(node, part, push){ // next siblings + while ((node = node.nextSibling)){ + if (node.nodeType === 1 && this.match(node, part)) push(node) + } + }, + + "++": function(node, part, push){ // next sibling and previous sibling + combinators['+'].call(this, node, part, push) + combinators['!+'].call(this, node, part, push) + }, + + "~~": function(node, part, push){ // next siblings and previous siblings + combinators['~'].call(this, node, part, push) + combinators['!~'].call(this, node, part, push) + }, + + "!": function(node, part, push){ // all parent nodes up to document + while ((node = node.parentNode)) if (node !== this.document && this.match(node, part)) push(node) + }, + + "!>": function(node, part, push){ // direct parent (one level) + node = node.parentNode + if (node !== this.document && this.match(node, part)) push(node) + }, + + "!+": function(node, part, push){ // previous sibling + while ((node = node.previousSibling)) if (node.nodeType == 1){ + if (this.match(node, part)) push(node) + break + } + }, + + "!^": function(node, part, push){ // last child + node = node.lastChild + if (node){ + if (node.nodeType == 1){ + if (this.match(node, part)) push(node) + } else { + combinators['!+'].call(this, node, part, push) + } + } + }, + + "!~": function(node, part, push){ // previous siblings + while ((node = node.previousSibling)){ + if (node.nodeType === 1 && this.match(node, part)) push(node) + } + } + +} + +Finder.prototype.search = function(context, expression, found){ + + if (!context) context = this.document + else if (!context.nodeType && context.document) context = context.document + + var expressions = parse(expression) + + // no expressions were parsed. todo: is this really necessary? + if (!expressions || !expressions.length) throw new Error("invalid expression") + + if (!found) found = [] + + var uniques, push = isArray(found) ? function(node){ + found[found.length] = node + } : function(node){ + found[found.length++] = node + } + + // if there is more than one expression we need to check for duplicates when we push to found + // this simply saves the old push and wraps it around an uid dupe check. + if (expressions.length > 1){ + uniques = {} + var plush = push + push = function(node){ + var uid = uniqueID(node) + if (!uniques[uid]){ + uniques[uid] = true + plush(node) + } + } + } + + // walker + + var node, nodes, part + + main: for (var i = 0; expression = expressions[i++];){ + + // querySelector + + // TODO: more functional tests + + // if there is querySelectorAll (and the expression does not fail) use it. + if (!slick.noQSA && this.querySelectorAll){ + + nodes = this.querySelectorAll(context, expression) + if (nodes !== true){ + if (nodes && nodes.length) for (var j = 0; node = nodes[j++];) if (node.nodeName > '@'){ + push(node) + } + continue main + } + } + + // if there is only one part in the expression we don't need to check each part for duplicates. + // todo: this might be too naive. while solid, there can be expression sequences that do not + // produce duplicates. "body div" for instance, can never give you each div more than once. + // "body div a" on the other hand might. + if (expression.length === 1){ + + part = expression[0] + combinators[part.combinator].call(this, context, part, push) + + } else { + + var cs = [context], c, f, u, p = function(node){ + var uid = uniqueID(node) + if (!u[uid]){ + u[uid] = true + f[f.length] = node + } + } + + // loop the expression parts + for (var j = 0; part = expression[j++];){ + f = []; u = {} + // loop the contexts + for (var k = 0; c = cs[k++];) combinators[part.combinator].call(this, c, part, p) + // nothing was found, the expression failed, continue to the next expression. + if (!f.length) continue main + cs = f // set the contexts for future parts (if any) + } + + if (i === 0) found = f // first expression. directly set found. + else for (var l = 0; l < f.length; l++) push(f[l]) // any other expression needs to push to found. + } + + } + + if (uniques && found && found.length > 1) this.sort(found) + + return found + +} + +Finder.prototype.sort = function(nodes){ + return this.sorter ? Array.prototype.sort.call(nodes, this.sorter) : nodes +} + +// TODO: most of these pseudo selectors include and qsa doesnt. fixme. + +var pseudos = { + + + // TODO: returns different results than qsa empty. + + 'empty': function(){ + return !(this && this.nodeType === 1) && !(this.innerText || this.textContent || '').length + }, + + 'not': function(expression){ + return !slick.matches(this, expression) + }, + + 'contains': function(text){ + return (this.innerText || this.textContent || '').indexOf(text) > -1 + }, + + 'first-child': function(){ + var node = this + while ((node = node.previousSibling)) if (node.nodeType == 1) return false + return true + }, + + 'last-child': function(){ + var node = this + while ((node = node.nextSibling)) if (node.nodeType == 1) return false + return true + }, + + 'only-child': function(){ + var prev = this + while ((prev = prev.previousSibling)) if (prev.nodeType == 1) return false + + var next = this + while ((next = next.nextSibling)) if (next.nodeType == 1) return false + + return true + }, + + 'first-of-type': function(){ + var node = this, nodeName = node.nodeName + while ((node = node.previousSibling)) if (node.nodeName == nodeName) return false + return true + }, + + 'last-of-type': function(){ + var node = this, nodeName = node.nodeName + while ((node = node.nextSibling)) if (node.nodeName == nodeName) return false + return true + }, + + 'only-of-type': function(){ + var prev = this, nodeName = this.nodeName + while ((prev = prev.previousSibling)) if (prev.nodeName == nodeName) return false + var next = this + while ((next = next.nextSibling)) if (next.nodeName == nodeName) return false + return true + }, + + 'enabled': function(){ + return !this.disabled + }, + + 'disabled': function(){ + return this.disabled + }, + + 'checked': function(){ + return this.checked || this.selected + }, + + 'selected': function(){ + return this.selected + }, + + 'focus': function(){ + var doc = this.ownerDocument + return doc.activeElement === this && (this.href || this.type || slick.hasAttribute(this, 'tabindex')) + }, + + 'root': function(){ + return (this === this.ownerDocument.documentElement) + } + +} + +Finder.prototype.match = function(node, bit, noTag, noId, noClass){ + + // TODO: more functional tests ? + + if (!slick.noQSA && this.matchesSelector){ + var matches = this.matchesSelector(node, bit) + if (matches !== null) return matches + } + + // normal matching + + if (!noTag && bit.tag){ + + var nodeName = node.nodeName.toLowerCase() + if (bit.tag === "*"){ + if (nodeName < "@") return false + } else if (nodeName != bit.tag){ + return false + } + + } + + if (!noId && bit.id && node.getAttribute('id') !== bit.id) return false + + var i, part + + if (!noClass && bit.classes){ + + var className = this.getAttribute(node, "class") + if (!className) return false + + for (part in bit.classes) if (!RegExp('(^|\\s)' + bit.classes[part] + '(\\s|$)').test(className)) return false + } + + var name, value + + if (bit.attributes) for (i = 0; part = bit.attributes[i++];){ + + var operator = part.operator, + escaped = part.escapedValue + + name = part.name + value = part.value + + if (!operator){ + + if (!this.hasAttribute(node, name)) return false + + } else { + + var actual = this.getAttribute(node, name) + if (actual == null) return false + + switch (operator){ + case '^=' : if (!RegExp( '^' + escaped ).test(actual)) return false; break + case '$=' : if (!RegExp( escaped + '$' ).test(actual)) return false; break + case '~=' : if (!RegExp('(^|\\s)' + escaped + '(\\s|$)').test(actual)) return false; break + case '|=' : if (!RegExp( '^' + escaped + '(-|$)' ).test(actual)) return false; break + + case '=' : if (actual !== value) return false; break + case '*=' : if (actual.indexOf(value) === -1) return false; break + default : return false + } + + } + } + + if (bit.pseudos) for (i = 0; part = bit.pseudos[i++];){ + + name = part.name + value = part.value + + if (pseudos[name]) return pseudos[name].call(node, value) + + if (value != null){ + if (this.getAttribute(node, name) !== value) return false + } else { + if (!this.hasAttribute(node, name)) return false + } + + } + + return true + +} + +Finder.prototype.matches = function(node, expression){ + + var expressions = parse(expression) + + if (expressions.length === 1 && expressions[0].length === 1){ // simplest match + return this.match(node, expressions[0][0]) + } + + // TODO: more functional tests ? + + if (!slick.noQSA && this.matchesSelector){ + var matches = this.matchesSelector(node, expressions) + if (matches !== null) return matches + } + + var nodes = this.search(this.document, expression, {length: 0}) + + for (var i = 0, res; res = nodes[i++];) if (node === res) return true + return false + +} + +var finders = {} + +var finder = function(context){ + var doc = context || document + if (doc.ownerDocument) doc = doc.ownerDocument + else if (doc.document) doc = doc.document + + if (doc.nodeType !== 9) throw new TypeError("invalid document") + + var uid = uniqueID(doc) + return finders[uid] || (finders[uid] = new Finder(doc)) +} + +// ... API ... + +var slick = function(expression, context){ + return slick.search(expression, context) +} + +slick.search = function(expression, context, found){ + return finder(context).search(context, expression, found) +} + +slick.find = function(expression, context){ + return finder(context).search(context, expression)[0] || null +} + +slick.getAttribute = function(node, name){ + return finder(node).getAttribute(node, name) +} + +slick.hasAttribute = function(node, name){ + return finder(node).hasAttribute(node, name) +} + +slick.contains = function(context, node){ + return finder(context).contains(context, node) +} + +slick.matches = function(node, expression){ + return finder(node).matches(node, expression) +} + +slick.sort = function(nodes){ + if (nodes && nodes.length > 1) finder(nodes[0]).sort(nodes) + return nodes +} + +slick.parse = parse; + +// slick.debug = true +// slick.noQSA = true + +module.exports = slick + +},{"./parser":98}],97:[function(require,module,exports){ +(function (global){(function (){ +/* +slick +*/"use strict" + +module.exports = "document" in global ? require("./finder") : { parse: require("./parser") } + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{"./finder":96,"./parser":98}],98:[function(require,module,exports){ +/* +Slick Parser + - originally created by the almighty Thomas Aylott <@subtlegradient> (http://subtlegradient.com) +*/"use strict" + +// Notable changes from Slick.Parser 1.0.x + +// The parser now uses 2 classes: Expressions and Expression +// `new Expressions` produces an array-like object containing a list of Expression objects +// - Expressions::toString() produces a cleaned up expressions string +// `new Expression` produces an array-like object +// - Expression::toString() produces a cleaned up expression string +// The only exposed method is parse, which produces a (cached) `new Expressions` instance +// parsed.raw is no longer present, use .toString() +// parsed.expression is now useless, just use the indices +// parsed.reverse() has been removed for now, due to its apparent uselessness +// Other changes in the Expressions object: +// - classNames are now unique, and save both escaped and unescaped values +// - attributes now save both escaped and unescaped values +// - pseudos now save both escaped and unescaped values + +var escapeRe = /([-.*+?^${}()|[\]\/\\])/g, + unescapeRe = /\\/g + +var escape = function(string){ + // XRegExp v2.0.0-beta-3 + // « https://github.com/slevithan/XRegExp/blob/master/src/xregexp.js + return (string + "").replace(escapeRe, '\\$1') +} + +var unescape = function(string){ + return (string + "").replace(unescapeRe, '') +} + +var slickRe = RegExp( +/* +#!/usr/bin/env ruby +puts "\t\t" + DATA.read.gsub(/\(\?x\)|\s+#.*$|\s+|\\$|\\n/,'') +__END__ + "(?x)^(?:\ + \\s* ( , ) \\s* # Separator \n\ + | \\s* ( + ) \\s* # Combinator \n\ + | ( \\s+ ) # CombinatorChildren \n\ + | ( + | \\* ) # Tag \n\ + | \\# ( + ) # ID \n\ + | \\. ( + ) # ClassName \n\ + | # Attribute \n\ + \\[ \ + \\s* (+) (?: \ + \\s* ([*^$!~|]?=) (?: \ + \\s* (?:\ + ([\"']?)(.*?)\\9 \ + )\ + ) \ + )? \\s* \ + \\](?!\\]) \n\ + | :+ ( + )(?:\ + \\( (?:\ + (?:([\"'])([^\\12]*)\\12)|((?:\\([^)]+\\)|[^()]*)+)\ + ) \\)\ + )?\ + )" +*/ +"^(?:\\s*(,)\\s*|\\s*(+)\\s*|(\\s+)|(+|\\*)|\\#(+)|\\.(+)|\\[\\s*(+)(?:\\s*([*^$!~|]?=)(?:\\s*(?:([\"']?)(.*?)\\9)))?\\s*\\](?!\\])|(:+)(+)(?:\\((?:(?:([\"'])([^\\13]*)\\13)|((?:\\([^)]+\\)|[^()]*)+))\\))?)" + .replace(//, '[' + escape(">+~`!@$%^&={}\\;/g, '(?:[\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])') + .replace(//g, '(?:[:\\w\\u00a1-\\uFFFF-]|\\\\[^\\s0-9a-f])') +) + +// Part + +var Part = function Part(combinator){ + this.combinator = combinator || " " + this.tag = "*" +} + +Part.prototype.toString = function(){ + + if (!this.raw){ + + var xpr = "", k, part + + xpr += this.tag || "*" + if (this.id) xpr += "#" + this.id + if (this.classes) xpr += "." + this.classList.join(".") + if (this.attributes) for (k = 0; part = this.attributes[k++];){ + xpr += "[" + part.name + (part.operator ? part.operator + '"' + part.value + '"' : '') + "]" + } + if (this.pseudos) for (k = 0; part = this.pseudos[k++];){ + xpr += ":" + part.name + if (part.value) xpr += "(" + part.value + ")" + } + + this.raw = xpr + + } + + return this.raw +} + +// Expression + +var Expression = function Expression(){ + this.length = 0 +} + +Expression.prototype.toString = function(){ + + if (!this.raw){ + + var xpr = "" + + for (var j = 0, bit; bit = this[j++];){ + if (j !== 1) xpr += " " + if (bit.combinator !== " ") xpr += bit.combinator + " " + xpr += bit + } + + this.raw = xpr + + } + + return this.raw +} + +var replacer = function( + rawMatch, + + separator, + combinator, + combinatorChildren, + + tagName, + id, + className, + + attributeKey, + attributeOperator, + attributeQuote, + attributeValue, + + pseudoMarker, + pseudoClass, + pseudoQuote, + pseudoClassQuotedValue, + pseudoClassValue +){ + + var expression, current + + if (separator || !this.length){ + expression = this[this.length++] = new Expression + if (separator) return '' + } + + if (!expression) expression = this[this.length - 1] + + if (combinator || combinatorChildren || !expression.length){ + current = expression[expression.length++] = new Part(combinator) + } + + if (!current) current = expression[expression.length - 1] + + if (tagName){ + + current.tag = unescape(tagName) + + } else if (id){ + + current.id = unescape(id) + + } else if (className){ + + var unescaped = unescape(className) + + var classes = current.classes || (current.classes = {}) + if (!classes[unescaped]){ + classes[unescaped] = escape(className) + var classList = current.classList || (current.classList = []) + classList.push(unescaped) + classList.sort() + } + + } else if (pseudoClass){ + + pseudoClassValue = pseudoClassValue || pseudoClassQuotedValue + + ;(current.pseudos || (current.pseudos = [])).push({ + type : pseudoMarker.length == 1 ? 'class' : 'element', + name : unescape(pseudoClass), + escapedName : escape(pseudoClass), + value : pseudoClassValue ? unescape(pseudoClassValue) : null, + escapedValue : pseudoClassValue ? escape(pseudoClassValue) : null + }) + + } else if (attributeKey){ + + attributeValue = attributeValue ? escape(attributeValue) : null + + ;(current.attributes || (current.attributes = [])).push({ + operator : attributeOperator, + name : unescape(attributeKey), + escapedName : escape(attributeKey), + value : attributeValue ? unescape(attributeValue) : null, + escapedValue : attributeValue ? escape(attributeValue) : null + }) + + } + + return '' + +} + +// Expressions + +var Expressions = function Expressions(expression){ + this.length = 0 + + var self = this + + var original = expression, replaced + + while (expression){ + replaced = expression.replace(slickRe, function(){ + return replacer.apply(self, arguments) + }) + if (replaced === expression) throw new Error(original + ' is an invalid expression') + expression = replaced + } +} + +Expressions.prototype.toString = function(){ + if (!this.raw){ + var expressions = [] + for (var i = 0, expression; expression = this[i++];) expressions.push(expression) + this.raw = expressions.join(", ") + } + + return this.raw +} + +var cache = {} + +var parse = function(expression){ + if (expression == null) return null + expression = ('' + expression).replace(/^\s+|\s+$/g, '') + return cache[expression] || (cache[expression] = new Expressions(expression)) +} + +module.exports = parse + +},{}],99:[function(require,module,exports){ +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + +},{}],100:[function(require,module,exports){ +(function (setImmediate,clearImmediate){(function (){ +var nextTick = require('process/browser.js').nextTick; +var apply = Function.prototype.apply; +var slice = Array.prototype.slice; +var immediateIds = {}; +var nextImmediateId = 0; + +// DOM APIs, for completeness + +exports.setTimeout = function() { + return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); +}; +exports.setInterval = function() { + return new Timeout(apply.call(setInterval, window, arguments), clearInterval); +}; +exports.clearTimeout = +exports.clearInterval = function(timeout) { timeout.close(); }; + +function Timeout(id, clearFn) { + this._id = id; + this._clearFn = clearFn; +} +Timeout.prototype.unref = Timeout.prototype.ref = function() {}; +Timeout.prototype.close = function() { + this._clearFn.call(window, this._id); +}; + +// Does not start the time, just sets up the members needed. +exports.enroll = function(item, msecs) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = msecs; +}; + +exports.unenroll = function(item) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = -1; +}; + +exports._unrefActive = exports.active = function(item) { + clearTimeout(item._idleTimeoutId); + + var msecs = item._idleTimeout; + if (msecs >= 0) { + item._idleTimeoutId = setTimeout(function onTimeout() { + if (item._onTimeout) + item._onTimeout(); + }, msecs); + } +}; + +// That's not how node.js implements it but the exposed api is the same. +exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { + var id = nextImmediateId++; + var args = arguments.length < 2 ? false : slice.call(arguments, 1); + + immediateIds[id] = true; + + nextTick(function onNextTick() { + if (immediateIds[id]) { + // fn.call() is faster so we optimize for the common use-case + // @see http://jsperf.com/call-apply-segu + if (args) { + fn.apply(null, args); + } else { + fn.call(null); + } + // Prevent ids from leaking + exports.clearImmediate(id); + } + }); + + return id; +}; + +exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { + delete immediateIds[id]; +}; +}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate) + +},{"process/browser.js":99,"timers":100}]},{},[1]) + +//# sourceMappingURL=main.js.map diff --git a/platforms/common/js/main.js b/platforms/common/js/main.js index bf245ac7c..e39c2178e 100644 --- a/platforms/common/js/main.js +++ b/platforms/common/js/main.js @@ -1 +1,41074 @@ -require=function i(r,o,a){function s(e,t){if(!o[e]){if(!r[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(l)return l(e,!0);throw(n=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",n}n=o[e]={exports:{}},r[e][0].call(n.exports,function(t){return s(r[e][1][t]||t)},n,n.exports,i,r,o,a)}return o[e].exports}for(var l="function"==typeof require&&require,t=0;t label").style("display","block");var l,u=0,c=0;s||e.parent(".card").style("display",a.checked()||i?"none":"inline-block"),f(s,function(t,e){var n;t=p(t),l=h(t.text()),l=l.match(new RegExp("^"+i+"|\\s"+i,"gi")),(l=a.checked()?Number(!!l)&Number(t.parent("label, h4").find('.enabler input[type="hidden"]').value()):l)?(!(n=(n=t.parent("[data-g-assignments-parent]"))&&n.data("g-assignments-parent"))||(n=t.parent(".card").find('[data-g-assignments-group="'+n+'"]'))&&n.style("display","block"),t.parent("label, h4").style("display","block"),c++):(t.parent("label, h4").style("display","none"),0),++u==s.length&&r&&o.style("display",c?"inline-block":"none")})},filterEnabledOnly:function(t,e){var n=p('[data-g-global-filter] input[type="text"]');g.globalFilterSection(t,n,e)},treatLabel:function(t,e){if(t&&t.stopPropagation&&t.preventDefault&&(t.stopPropagation(),t.preventDefault()),!p(t.target).matches(".knob, .toggle")){t=e.find('input[type="hidden"]:not([disabled])');if(t){e=!!+(e=t.value());return t.value(Number(!e)).emit("change"),p("body").emit("change",{target:t}),!1}}},globalToggleSection:function(i,t){var e=null==t.data("g-assignments-check")?"[data-g-assignments-uncheck]":"[data-g-assignments-check]",t=p("[data-save]"),e=p("#assignments .card "+e+", .settings-assignments .card "+e);e&&(t.disabled(!0),f(e,function(t,e,n){g.toggleSection(i,p(t),e,n)}))},globalFilterSection:function(e,t){var n=t.value(),i=p("[data-assignments-enabledonly]"),t=p('#assignments .card .search input[type="text"], .settings-assignments .card .search input[type="text"]');(t||i.checked())&&f(t,function(t){g.filterSection(e,p(t),n,"global")})},toggleStateDelegation:function(t,e){var n="1"==e.value();e.attribute("disabled",!n)},chromeFix:function(){var t,n,i;!g.isChrome()||(t=p("#assignments .settings-param-wrapper, .settings-assignments .settings-param-wrapper"))&&t.forEach(function(t){var e;t=p(t),i=parseInt(t.compute("max-height"),10),n=t[0].getBoundingClientRect().height,t.style({overflow:i<=n?"auto":"visible"}),i<=n&&(e=100,o(t,"scroll",function(){e=100==e?100.01:100,t.parent(".card").style("width",e+"%")}))})},isChrome:function(){return-1 ol > li > a").forEach(function(e,t){var n=(e=r(e)).href(),i=new RegExp("#(common|"+GANTRY_PLATFORM+")$","gi"),n=!n.match(i),i="chevron-"+(n?"down":"up");l(e.text())&&(t&&!n&&e.parent("li").after(e.parent("ol").find("> li")),o('i[class="fa g-changelog-toggle fa-fw fa-'+i+'"][aria-hidden="true"]').bottom(e),n&&e.nextSibling().style({overflow:"hidden",height:0}),e.on("click",function(t){t.preventDefault();t=e.find('i[class*="fa-chevron-"]');t.hasClass("fa-chevron-down")?(t.removeClass("fa-chevron-down").addClass("fa-chevron-up"),e.nextSibling().slideDown()):(t.removeClass("fa-chevron-up").addClass("fa-chevron-down"),e.nextSibling().slideUp())}))})}})})})},{"../ui":54,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,elements:113,"elements/domready":111,"elements/zen":137,"mout/string/interpolate":261,"mout/string/trim":272}],5:[function(t,e,n){"use strict";var p=t("elements"),i=t("elements/domready"),r=t("agent"),f=t("../ui").modal,m=t("mout/random/guid"),o=t("mout/string/trim"),a=t("../utils/get-ajax-suffix"),g=t("../utils/get-ajax-url").parse,v=(t("../utils/get-ajax-url").global,t("../utils/history")),b=t("mout/queryString/getParam"),y=t("mout/queryString/setParam");i(function(){var c,d,h,e,i=p("body");i.delegate("keydown",".config-select-wrap [data-title-edit]",function(t,e){var n=t.which||t.keyCode;32!=n&&13!=n||(t.preventDefault(),i.emit("mousedown",t))}),i.delegate("mousedown",".config-select-wrap [data-title-edit]",function(t,u){c=u.siblings(".g-selectize-control"),d=u.siblings("select"),(h=u.siblings("[data-title-editable]")).gConfEditAttached||(h.gConfEditAttached=!0,h.on("title-edit-end",function(s,l,t){return s=o(s),t||s==l?(c.style("display","inline-block"),void h.style("display","none").attribute("contenteditable",null)):(u.addClass("disabled"),u.removeClass("fa-pencil").addClass("fa-spin-fast fa-spinner"),e=h.data("g-config-href"),void r("post",g(e+a()),{title:s},function(t,e){var n,i,r,o,a;e.body.success?(n=d.selectizeInstance,a=d.value(),(o=n.Options[a])[n.options.labelField]=s,n.updateOption(a,o),c.style("display","inline-block"),h.style("display","none")):(f.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),h.data("title-editable",l).text(l)),n=s,i=a,"wordpress"==GANTRY_PLATFORM&&(r=n.replace(/[^a-z\d_-\s]/i,"_").toLowerCase(),o=p('[href*="/'+i+'/"]'),a=v.getPageUrl(),n=b(a,"view"),o&&o.forEach(function(t){var e=(t=p(t)).href().replace("/"+i+"/","/"+r+"/");t.href(e)}),n=n.replace("/"+i+"/","/"+r+"/"),a=y(a,"view",n),v.replaceState({uuid:m(),doNothing:!0},window.document.title,a)),u.removeClass("disabled"),u.removeClass("fa-spin-fast fa-spinner").addClass("fa-pencil")}))})),h.style({width:c.compute("width"),display:"inline-block"}),c.style("display","none")})}),e.exports={}},{"../ui":54,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"../utils/history":75,agent:80,elements:113,"elements/domready":111,"mout/queryString/getParam":247,"mout/queryString/setParam":249,"mout/random/guid":251,"mout/string/trim":272}],6:[function(t,e,n){"use strict";var c=t("elements"),d=t("elements/zen"),i=t("elements/domready"),l=t("mout/string/trim"),h=t("mout/object/keys"),p=t("../ui").modal,f=t("../ui").toastr,m=t("agent"),g=t("../utils/get-ajax-suffix"),v=t("../utils/get-ajax-url").parse,b=t("../utils/get-ajax-url").global,y=t("../utils/flags-state");t("./dropdown-edit"),i(function(){var s=c("body");s.delegate("click","[data-g5-outline-create], [data-g5-outline-duplicate]",function(t,e){t&&t.preventDefault(),p.open({content:"Loading",method:"post",overlayClickToClose:!1,remote:v(e.href()+g()),remoteLoaded:function(t,a){var s,l;t.body.success?(s=a.elements.content.find('[name="title"]'),l=a.elements.content.find("[data-g-outline-create-confirm]"),s.on("keyup",function(t){13===t.which&&l.emit("click")}),l.on("click",function(){l.hideIndicator(),l.showIndicator();var t=v(l.data("g-outline-create-confirm")+g()),e=a.elements.content.find('[name="from"]:checked'),n=a.elements.content.find('[name="preset"]'),i=a.elements.content.find('[name="outline"]'),r=a.elements.content.find('[name="inherit"]'),o={title:s.value(),from:e?e.value():null,preset:n?n.value():null,outline:i?i.value():null,inherit:r.checked()?1:0};["title","from","preset","outline"].forEach(function(t){o[t]||delete o[t]}),m("post",t,o,function(t,e){var n,i;l.hideIndicator(),e.body.success?(n=c("#configurations").find("ul").find("li"),(i=d("li").attribute("class",n.attribute("class"))).after(n).html(e.body.outline),f.success(e.body.html||"Action successfully completed.",e.body.title||""),u(i.find("[data-title-editable]")),p.close()):p.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}})})}),setTimeout(function(){s[0].focus()},5)):p.enableCloseByOverlay()}})}),s.delegate("change",'input[type="radio"]#from-preset, input[type="radio"]#from-outline',function(t,e){var n=(e=c(e)).value(),e=e.parent(".card").search(".g-create-from").style("display","none").filter(function(t){return(t=c(t)).hasClass("g-create-from-"+n)});e&&c(e).style("display","block")}),s.delegate("click","#configurations [data-g-config]",function(t,a){var e=a.data("g-config"),n=a.data("g-config-href"),i=a.data("g-config-href-confirm"),r=window.btoa(n),o=(a.data("g-config-method")||"post").toLowerCase();if(t&&t.preventDefault&&t.preventDefault(),"delete"==e&&!y.get("free:to:delete:"+r,!1))return y.warning({url:v(n+g()),callback:function(t,e){var n=e.find("[data-g-delete-confirm]"),i=e.find("[data-g-delete-cancel]");n&&(n.on("click",function(t){return t.preventDefault(),!this.attribute("disabled")&&(y.get("free:to:delete:"+r,!0),c([n,i]).attribute("disabled"),s.emit("click",{target:a}),void p.close())}),i.on("click",function(t){return t.preventDefault(),!this.attribute("disabled")&&(c([n,i]).attribute("disabled"),y.get("free:to:delete:"+r,!1),void p.close())}))}}),!1;a.hideIndicator(),a.showIndicator(),m(o,v((i||n)+g()),{},function(t,e){var n,i,r,o;e.body.success?(n=(o=c("#configuration-selector")).value(),i=e.body.outline,r=c('[href="'+b("configurations")+'"]'),!i||n!=i||(o=h(o.selectizeInstance.Options)).length&&r.href(r.href().replace("style="+i,"style="+o.shift())),r?s.emit("click",{target:r}):window.location=window.location,f.success(e.body.html||"Action successfully completed.",e.body.title||""),i&&(s.outlineDeleted=i)):p.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),a.hideIndicator()})});function e(r,o,t){var a,e,s;this.style("text-overflow","ellipsis"),t||r==o||(e=(a=this).data("g-config-href"),t=(a.data("g-config-method")||"post").toLowerCase(),(s=a.parent()).showIndicator(),s.find("[data-title-edit]").addClass("disabled"),m(t,v(e+g()),{title:l(r)},function(t,e){var n,i;e.body.success?(a.data("title",r).data("tip",r),n=(i=d("div").html(e.body.outline)).find("h4 span:last-child"),i=i.find(".outline-actions"),a.parent(".card").find("h4 span:last-child").html(n.html()),a.parent(".card").find(".outline-actions").html(i.html())):(p.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),a.data("title-editable",o).text(o)),s.hideIndicator(),s.find("[data-title-edit]").removeClass("disabled")}))}var u=function(t){t&&t.length&&t.forEach(function(t){(t=c(t)).confWasAttached=!0,t.on("title-edit-start",function(){t.style("text-overflow","inherit")}),t.on("title-edit-end",e)})};s.on("statechangeAfter",function(t,e){var n=c("#configurations [data-title-editable]");if(!n)return!0;n=n.filter(function(t){return void 0===c(t).confWasAttached}),u(n)}),u(c("#configurations [data-title-editable]"))}),e.exports={}},{"../ui":54,"../utils/flags-state":69,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"./dropdown-edit":5,agent:80,elements:113,"elements/domready":111,"elements/zen":137,"mout/object/keys":236,"mout/string/trim":272}],7:[function(t,e,n){"use strict";var i=t("elements/domready"),a=t("elements/attributes"),s=t("prime/map"),o=t("mout/lang/deepEquals"),l=t("mout/lang/is"),u=t("mout/lang/isString"),c=t("mout/object/has"),d=t("mout/collection/forEach"),h=(t("mout/array/invoke"),t("../utils/history")),p=t("../utils/flags-state"),r=t("./submit");t("./multicheckbox");function f(t){var e,n,i=new s,r=a("[data-g-styles-defaults]"),o=a('input[type="checkbox"].settings-param-toggle'),r=r?JSON.parse(r.data("g-styles-defaults")):{};return o&&(e={},o.forEach(function(t){t=a(t),e[t.id()]=t.checked()}),i.set("__js__overrides",JSON.stringify(e))),t?(t.forEach(function(t){(n=a('[name="'+t+'"]'))&&i.set(t,n.value())}),i):!!(t=a(".settings-block [name]"))&&(t.forEach(function(t){var e=(t=a(t)).attribute("name"),n=!c(r,e);"checkbox"!=t.type()||t.value().length||t.value("0"),i.set(e,n?t.value():r[e])},this),i)}var m,g={single:function(){},whole:function(){},blanks:function(){},presets:function(){}};i(function(){var r,i=a("body");m=f(),g.single=function(t,e){var n=e.parent(".settings-param")||e.parent("h4")||e.parent(".input-group"),i=n?n.matches("h4")?n:n.find(".settings-param-title, .g-instancepicker-title"):null,r=!!n&&n.find(".settings-param-toggle"),o=!1,a=e.hasClass("settings-param-toggle");if(n){if(a)return g.whole("force");"checkbox"==e.type()&&e.value(Number(e.checked()).toString()),m&&null==m.get(e.attribute("name"))&&(m.set(e.attribute("name"),e.value()),o=!0),i&&m&&null!=m.get(e.attribute("name"))&&(m.get(e.attribute("name"))!==e.value()||o?(r&&t.forceOverride&&!r.checked()&&r[0].click(),i.showIndicator("changes-indicator font-small far fa-circle fa-fw")):(r&&t.forceOverride&&r.checked()&&r[0].click(),i.hideIndicator()),g.blanks(t,n.find(".settings-param-field")),g.whole("force"),g.presets())}},g.whole=function(t){var e;m&&(e=o(m,f(t?m.keys():null),function(t,e){return u(t)&&u(e)&&"#"==t.substr(0,1)&&"#"==e.substr(0,1)?t.toLowerCase()==e.toLowerCase():l(t,e)}),(t=a("[data-save]"))&&(p.set("pending",!e),t[e?"hideIndicator":"showIndicator"]("changes-indicator far fa-circle fa-fw")))},g.blanks=function(t,e){if(e){var n=e.find("[name]"),e=e.find(".g-reset-field");if(!n||!e)return!0;!n.value()||n.disabled()?e.style("display","none"):e.removeAttribute("style")}},g.presets=function(){var i,n,t=a("[data-g-styles]");t&&(r||(r=new s,d(t,function(t,e){var n;t=a(t),i={index:e,map:(e=JSON.parse(t.data("g-styles")),n=new s,d(e,function(t,e){n.set(e,t)}),n)},r.set(t,i)})),r.forEach(function(t,e){(n=f(t.map.keys())).unset("__js__overrides"),n=o(n,t.map,function(t,e){return t==e}),a(a("[data-g-styles]")[t.index]).parent()[n?"addClass":"removeClass"]("g-preset-match")}))},i.delegate("input",'.settings-block input[name][type="text"], .settings-block textarea[name]',g.single),i.delegate("change",'.settings-block input[name][type="hidden"], .settings-block input[name][type="checkbox"], .settings-block select[name], .settings-block .selectized[name], .settings-block input[id][type="checkbox"].settings-param-toggle',g.single),i.delegate("input",".g-urltemplate",function(t,e){var n,i=e.parent(".settings-param").siblings();(i=i&&i.find("[data-g-urltemplate]"))&&(n=i.data("g-urltemplate"),i.attribute("href",n.replace(/#ID#/g,e.value())))}),i.delegate("mouseenter",".settings-param-field",g.blanks,!0),i.delegate("click",".g-reset-field",function(t,e){var n,e=e.parent(".settings-param-field");e&&(n=e.find("[name]"))&&!n.disabled()&&((e=n.selectizeInstance)?e.setValue(""):n.value(""),n.emit("change"),i.emit("input",{target:n}),i.emit("keyup",{target:n}))}),i.on("statechangeEnd",function(){h.getState();i.emit("updateOriginalFields")}),i.on("updateOriginalFields",function(){m=f(),g.presets()}),g.presets()}),e.exports={compare:g,collect:f,submit:r}},{"../utils/flags-state":69,"../utils/history":75,"./multicheckbox":8,"./submit":9,"elements/attributes":108,"elements/domready":111,"mout/array/invoke":178,"mout/collection/forEach":189,"mout/lang/deepEquals":201,"mout/lang/is":202,"mout/lang/isString":211,"mout/object/has":234,"prime/map":302}],8:[function(t,e,n){"use strict";var a=t("elements/attributes"),i=t("elements/domready"),s=t("mout/array/remove"),l=t("mout/array/insert");t("mout/array/contains");i(function(){var o=a("body");o.delegate("change",'.input-multicheckbox .input-group input[name][type="hidden"]',function(t,e){var n=e.attribute("name"),i=e.value().split(","),n=a('[data-multicheckbox-field="'+n+'"]');n&&n.forEach(function(t){(t=a(t)).checked()&&l(i,t.value()),t.checked()||s(i,t.value())}),e.value(i.filter(String).join(","))}),o.delegate("change",'.input-multicheckbox .input-group input[data-multicheckbox-field][type="checkbox"]',function(t,e){var n=a('[name="'+e.data("multicheckbox-field")+'"]'),i=e.value(),r=n.value().split(","),e=e.checked();e&&l(r,i),e||s(r,i),n.value(r.filter(String).join(",")),o.emit("change",{target:n})})})},{"elements/attributes":108,"elements/domready":111,"mout/array/contains":166,"mout/array/insert":176,"mout/array/remove":181}],9:[function(t,e,n){"use strict";var l=t("elements"),u=t("mout/lang/isArray"),c=t("mout/array/contains"),i=t("mout/string/trim"),d=t("../utils/field-validation");e.exports=function(t,r,o){var a=[],s=[];t=l(t),r=l(r),o=o||{},l(t).forEach(function(t){var e,n=(t=l(t)).attribute("name"),i=t.attribute("type");!n||t.disabled()||"radio"==i&&!t.checked()||(t=r.find('[name="'+n+'"]'+("radio"==i?":checked":"")),(t="checkbox"===i&&r.find('[type="hidden"][name="'+n+'"]')?r.find('[name="'+n+'"][type="checkbox"]'):t)&&(e="checkbox"==t.type()?Number(t.checked()):t.value(),i=(i=(i=t.parent(".settings-param"))?i.find('> input[type="checkbox"]'):null)||l(t.data("override-target")),c(["select","select-multiple"],t.type())&&t.attribute("multiple")&&(e=(t.search("option[selected]")||[]).map(function(t){return l(t).value()})),i&&!i.checked()||(d(t)||s.push(t),u(e)?e.forEach(function(t){a.push(n+"[]="+encodeURIComponent(t))}):(!o.submitUnchecked||"checkbox"!=t.type()||"checkbox"==t.type()&&e)&&a.push(n+"="+encodeURIComponent(e)))))});var e,t=r.search("h4 [data-title-editable]");return t&&t.forEach(function(t){(t=l(t)).parent("[data-collection-template]")||(e=t.data("collection-key")||(o.isRoot?"settings[title]":"title"),a.push(e+"="+encodeURIComponent(i(t.data("title-editable")))))}),{valid:a,invalid:s}}},{"../utils/field-validation":68,elements:113,"mout/array/contains":166,"mout/lang/isArray":203,"mout/string/trim":272}],10:[function(t,e,n){"use strict";var i=t("prime"),r=t("elements"),o=t("./base"),a=t("elements/zen"),s=t("../../utils/get-ajax-url").config,i=new i({inherits:o,options:{type:"atom"},constructor:function(t){o.call(this,t),this.on("changed",this.hasChanged)},updateTitle:function(t){return this.block.find(".title").text(t),this.setTitle(t),this},layout:function(){var t=s(this.getPageId()+"/layout/"+this.getType()+"/"+this.getId()),e=this.getSubType()?'data-lm-blocksubtype="'+this.getSubType()+'"':"";return'
'+this.getTitle()+''+(this.getSubType()||this.getKey()||this.getType())+'
'},hasChanged:function(t,e){var n=this.block.find("span > i.changes-indicator:first-child");n&&e&&!e.changeState||(this.block[t?"addClass":"removeClass"]("block-has-changes"),!t&&n&&n.remove(),t&&!n&&a("i.far.fa-circle.changes-indicator").before(this.block.find(".icon")))},onRendered:function(t,e){!r('[data-lm-disabled][data-lm-subtype="'+this.getSubType()+'"]')&&0!==this.getAttribute("enabled")||this.disable()}});e.exports=i},{"../../utils/get-ajax-url":71,"./base":12,elements:113,"elements/zen":137,prime:301}],11:[function(t,e,n){"use strict";var i=t("prime"),r=t("elements"),o=t("elements/zen"),a=t("mout/function/bind"),t=new i({inherits:t("./section"),options:{type:"atoms",attributes:{name:"Atoms Section"}},layout:function(){return this.deprecated='
Looking for Atoms? To make it easier we moved them in the Page Settings.
','"},getId:function(){return this.id||(this.id=this.options.type)},onDone:function(t){if(!this.block.search('[data-lm-blocktype="atom"]')){var e=[this.getId()],n=this.block.search("[data-lm-id]");return n&&n.forEach(function(t){e.push(r(t).data("lm-id"))}),e.reverse().forEach(a(function(t){this.options.builder.remove(t)},this)),this.block.empty()[0].outerHTML=this.deprecated,void this._attachRedirect()}this.block.search("[data-lm-id]")||(this.grid.insert(this.block,"bottom"),this.options.builder.add(this.grid)),o("div").html(this.deprecated).firstChild().after(this.block),this._attachRedirect()},_attachRedirect:function(){var e=r('[data-g5-nav="page"]');e&&r(".atoms-notice a").on("click",function(t){t.preventDefault(),r("body").emit("click",{target:e})})}});e.exports=t},{"./section":20,elements:113,"elements/zen":137,"mout/function/bind":192,prime:301}],12:[function(t,e,n){"use strict";var i=t("prime"),r=t("prime-util/prime/options"),o=t("prime-util/prime/bound"),a=t("prime/emitter"),s=t("elements/zen"),l=t("mout/string/trim"),u=t("elements"),c=t("../id"),d=t("mout/object/size"),h=t("mout/object/get"),p=t("mout/object/has"),f=t("mout/object/set"),m=t("../../utils/translate"),g=t("../../utils/get-outline").getCurrentOutline;t("elements/traversal");a=new i({mixin:[o,r],inherits:a,options:{subtype:!1,attributes:{},inherit:{}},constructor:function(t){return this.setOptions(t),this.fresh=!this.options.id,this.id=this.options.id||c(this.options),this.attributes=this.options.attributes||{},this.inherit=this.options.inherit||{},this.block=s("div").html(this.layout()).firstChild(),this.on("rendered",this.bound("onRendered")),this},guid:function(){return guid()},getId:function(){return this.id||(this.id=c(this.options))},getType:function(){return this.options.type||""},getSubType:function(){return this.options.subtype||""},getTitle:function(){return l(this.options.title||"Untitled")},setTitle:function(t){return this.options.title=l(t||"Untitled"),this},getKey:function(){return""},getPageId:function(){var t=u("[data-lm-root]");return t?t.data("lm-page"):"data-root-not-found"},getAttribute:function(t){return h(this.attributes,t)},getAttributes:function(){return this.attributes||{}},getInheritance:function(){return this.inherit||{}},updateTitle:function(){return this},setAttribute:function(t,e){return f(this.attributes,t,e),this},setAttributes:function(t){return this.attributes=t,this},setInheritance:function(t){return this.inherit=t,this},hasAttribute:function(t){return p(this.attributes,t)},enableInheritance:function(){},disableInheritance:function(){},refreshInheritance:function(){},hasInheritance:function(){return d(this.inherit)&&this.inherit.outline!=g()},disable:function(){this.block.title(m("GANTRY5_PLATFORM_JS_LM_DISABLED_PARTICLE","particle")),this.block.addClass("particle-disabled")},enable:function(){this.block.removeAttribute("title"),this.block.removeClass("particle-disabled")},insert:function(t,e){return this.block[e||"after"](t),this},adopt:function(t){return t.insert(this.block),this},isNew:function(t){return void 0!==t&&(this.fresh=!!t),this.fresh},dropzone:function(){return"data-lm-dropzone"},addDropzone:function(){this.block.data("lm-dropzone",!0)},removeDropzone:function(){this.block.data("lm-dropzone",null)},layout:function(){},onRendered:function(){},setLayout:function(t){return this.block=t,this},getLimits:function(){return!1}});e.exports=a},{"../../utils/get-outline":72,"../../utils/translate":78,"../id":27,elements:113,"elements/traversal":136,"elements/zen":137,"mout/object/get":233,"mout/object/has":234,"mout/object/set":241,"mout/object/size":242,"mout/string/trim":272,prime:301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],13:[function(t,e,n){"use strict";var i=t("prime"),r=t("./base"),o=t("../../utils/elements.utils"),a=t("elements/zen"),s=t("mout/number/enforcePrecision"),l=t("mout/function/bind"),i=new i({inherits:r,options:{type:"block",attributes:{size:100}},constructor:function(t){r.call(this,t),t.attributes&&t.attributes.size&&this.setAttribute("size",s(t.attributes.size,1)),this.on("changed",this.hasChanged)},getSize:function(){return s(this.getAttribute("size"),1)},setSize:function(t,e){t=void 0===t?this.getSize():Math.max(0,Math.min(100,parseFloat(t))),t=s(t,1),e&&this.setAttribute("size",t),o(this.block).style({flex:"0 1 "+t+"%","-webkit-flex":"0 1 "+t+"%","-ms-flex":"0 1 "+t+"%"}),this.emit("resized",t,this)},setAnimatedSize:function(t,e){t=void 0===t?this.getSize():Math.max(0,Math.min(100,parseFloat(t))),t=s(t,1),e&&this.setAttribute("size",t),o(this.block).animate({flex:"0 1 "+t+"%","-webkit-flex":"0 1 "+t+"%","-ms-flex":"0 1 "+t+"%"},l(function(){this.block.attribute("style",null),this.setSize(t)},this)),this.emit("resized",t,this)},setLabelSize:function(t){var e=this.block.find("> .particle-size");if(!e)return!1;e.text(s(t,1)+"%")},layout:function(){return'
'},onRendered:function(t,e){t.block.find('> [data-lm-blocktype="section"]')&&this.removeDropzone(),!e||((e=e.block.parent()).data("lm-root")||"container"==e.data("lm-blocktype")&&(e.parent().data("lm-root")||"wrapper"==e.parent().data("lm-blocktype")))&&(a("span.particle-size").text(this.getSize()+"%").top(t.block),t.on("resized",this.bound("onResize")))},onResize:function(t){this.setLabelSize(t)},hasChanged:function(t){var e,n=this.block.find('> [data-lm-id]:not([data-lm-blocktype="section"]):not([data-lm-blocktype="container"])');if(this.changeState=t,!n)return e=(n=this.block.find("> .particle-size")||this.block.parent('[data-lm-blocktype="block"]').find("> .particle-size")).find("i:first-child"),!t&&e&&e.remove(),void(t&&!e&&a("i.far.fa-circle.changes-indicator").top(n));n=this.options.builder.get(n.data("lm-id"));n&&n.emit("changed",t,this)}});e.exports=i},{"../../utils/elements.utils":66,"./base":12,"elements/zen":137,"mout/function/bind":192,"mout/number/enforcePrecision":222,prime:301}],14:[function(t,e,n){"use strict";var i=t("prime"),r=t("./base"),o=t("elements/zen"),a=(t("elements"),t("../../utils/get-ajax-url").config),s=t("../../utils/translate"),i=new i({inherits:r,options:{type:"container"},constructor:function(t){r.call(this,t),this.on("changed",this.hasChanged)},layout:function(){return'
'},onRendered:function(t,e){e||this.addSettings(t)},hasChanged:function(t,e){var n=this.block.find("span.title > i:first-child");n&&e&&!e.changeState||(this.block[t?"addClass":"removeClass"]("block-has-changes"),!t&&n&&n.remove(),!t||n||(n=this.block.find("span.title"))&&o("i.far.fa-circle.changes-indicator").top(n))},addSettings:function(t){var e=a(this.getPageId()+"/layout/"+this.getType()+"/"+this.getId()),n=o("div.container-wrapper.clearfix").top(t.block),t=o("div.container-title").bottom(n),n=o("div.container-actions").bottom(n);t.html(''+this.getType()+""),n.html('')}});e.exports=i},{"../../utils/get-ajax-url":71,"../../utils/translate":78,"./base":12,elements:113,"elements/zen":137,prime:301}],15:[function(t,e,n){"use strict";var i=t("prime"),r=t("./base"),i=(t("elements"),t("../../utils/get-ajax-url").config,new i({inherits:r,options:{type:"grid"},constructor:function(t){r.call(this,t),this.on("changed",this.hasChanged)},layout:function(){return'
'},onRendered:function(){var t=this.block.parent();t&&"atoms"==t.data("lm-blocktype")&&this.block.removeClass("nowrap"),(t&&t.data("lm-root")||"container"==t.data("lm-blocktype")&&t.parent().data("lm-root"))&&this.removeDropzone()},hasChanged:function(t){var e=this.block.parent('[data-lm-blocktype="section"]'),n=!!e&&e.data("lm-id");this.changeState=t,e&&n&&this.options.builder&&this.options.builder.get(n).emit("changed",t,this)}}));e.exports=i},{"../../utils/get-ajax-url":71,"./base":12,elements:113,prime:301}],16:[function(t,e,n){e.exports={base:t("./base"),atom:t("./atom"),section:t("./section"),offcanvas:t("./offcanvas"),wrapper:t("./wrapper"),atoms:t("./atoms"),grid:t("./grid"),container:t("./container"),block:t("./block"),particle:t("./particle"),position:t("./position"),system:t("./system"),spacer:t("./spacer")}},{"./atom":10,"./atoms":11,"./base":12,"./block":13,"./container":14,"./grid":15,"./offcanvas":17,"./particle":18,"./position":19,"./section":20,"./spacer":21,"./system":22,"./wrapper":23}],17:[function(t,e,n){"use strict";var i=t("prime"),r=t("./section"),o=t("../../utils/get-ajax-url").config,a=t("../../utils/get-outline").getOutlineNameById,s=t("../../utils/translate"),r=new i({inherits:r,options:{type:"offcanvas",attributes:{name:"Offcanvas Section"}},layout:function(){var t,e=o(this.getPageId()+"/layout/"+this.getType()+"/"+this.getId()),n="",i="";return this.hasInheritance()&&(t=a(this.inherit.outline),n='
'+s("GANTRY5_PLATFORM_INHERITING_FROM_X",""+t+"")+"
",i=" g-inheriting g-inheriting-"+this.inherit.include.join(" g-inheriting-")),'

'+this.getAttribute("name")+'

'+n+"
"},getId:function(){return this.id||(this.id=this.options.type)}});e.exports=r},{"../../utils/get-ajax-url":71,"../../utils/get-outline":72,"../../utils/translate":78,"./section":20,prime:301}],18:[function(u,c,t){!function(l){!function(){"use strict";var t=u("prime"),i=u("elements"),e=u("./atom"),n=(u("mout/function/bind"),u("mout/number/enforcePrecision")),r=u("mout/object/forOwn"),o=u("../../utils/get-ajax-url").config,a=u("../../utils/get-outline").getOutlineNameById,s=u("../../utils/translate"),t=new t({inherits:e,options:{type:"particle"},constructor:function(t){e.call(this,t)},layout:function(){var t=o(this.getPageId()+"/layout/"+this.getType()+"/"+this.getId()),e=this.getSubType()?'data-lm-blocksubtype="'+this.getSubType()+'"':"",n="";return this.hasInheritance()&&(n=" g-inheriting",this.inherit.include.length&&(n+=" g-inheriting-"+this.inherit.include.join(" g-inheriting-"))),'
'+this.getTitle()+''+(this.getKey()||this.getSubType()||this.getType())+'
'},enableInheritance:function(){var n;this.block.attribute("class",this.cleanKlass(this.block.attribute("class"))),this.hasInheritance()&&(a(this.inherit.outline),n=this.block.find(".icon"),this.block.addClass("g-inheriting"),this.inherit.include.length&&this.block.addClass("g-inheriting-"+this.inherit.include.join(" g-inheriting-")),this.block.find(".icon .fa").attribute("class","fa "+this.getIcon()),r(this.getInheritanceTip(),function(t,e){n.data(e,t)}),l.G5.tips.reload())},disableInheritance:function(){var n=this.block.find(".icon");this.block.attribute("class",this.cleanKlass(this.block.attribute("class"))),this.block.removeClass("g-inheriting"),this.block.find(".icon .fa").attribute("class","fa "+this.getIcon()),r(this.getInheritanceTip(),function(t,e){n.data(e,null)}),l.G5.tips.reload()},refreshInheritance:function(){this.block[this.hasInheritance()?"removeClass":"addClass"]("g-inheritance"),this.hasInheritance()&&this.block.attribute("class",this.cleanKlass(this.block.attribute("class")))},addInheritanceTip:function(t){var n,e=this.getInheritanceTip();return t&&(n="",r(e,function(t,e){n+="data-"+e+'="'+t+'" '}),e=n),this.hasInheritance()?e:""},getInheritanceTip:function(){var t=a(this.inherit?this.inherit.outline:null),e=this.inherit.particle||"",n=(this.inherit.include||[]).join(", ");return{tip:s("GANTRY5_PLATFORM_INHERITING_FROM_X",""+t+"")+"
ID: "+e+"
Replace: "+n,"tip-offset":-10,"tip-place":"top-right"}},cleanKlass:function(t){return(t=(t||"").split(" ")).filter(function(t){return!t.match(/^g-inheriting-/)}).join(" ")},setLabelSize:function(t){var e=this.block.find(".particle-size");if(!e)return!1;e.text(n(t,1)+"%")},onRendered:function(t,e){var n=e.getSize()||100;!i('[data-lm-disabled][data-lm-subtype="'+this.getSubType()+'"]')&&0!==this.getAttribute("enabled")||this.disable(),this.setLabelSize(n),e.on("resized",this.bound("onParentResize"))},getParent:function(){var t=this.block.parent("[data-lm-id]");return this.options.builder.get(t.data("lm-id"))},onParentResize:function(t){this.setLabelSize(t)},getIcon:function(){if(this.hasInheritance())return"fa-lock";var t=this.getType(),e=this.getSubType(),e=i('.particles-container [data-lm-blocktype="'+t+'"][data-lm-subtype="'+e+'"]');return e?e.data("lm-icon"):"fa-cube"},getLimits:function(t){if(!t)return!1;t=t.block.nextSibling()||t.block.previousSibling()||!1;if(!t)return[100,100];t=this.options.builder.get(t.data("lm-id"));return[5,this.getParent().getSize()+t.getSize()-5]}});c.exports=t}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../utils/get-ajax-url":71,"../../utils/get-outline":72,"../../utils/translate":78,"./atom":10,elements:113,"mout/function/bind":192,"mout/number/enforcePrecision":222,"mout/object/forOwn":232,prime:301}],19:[function(t,e,n){"use strict";var i=t("prime"),r=t("mout/string/trim"),o=t("./particle"),a=0,i=new i({inherits:o,options:{type:"position"},constructor:function(t){++a,o.call(this,t),this.setAttribute("title",this.getTitle()),this.setAttribute("key",this.getKey()),this.isNew()&&--a},getTitle:function(){return r(this.options.title||"Position "+a)},getKey:function(){return this.getAttribute("key")||r(this.getTitle()).replace(/\s/g,"-").toLowerCase()},updateKey:function(t){return this.options.key=t||this.getKey(),this.block.find(".font-small").text(this.getKey()),this}});e.exports=i},{"./particle":18,"mout/string/trim":272,prime:301}],20:[function(t,e,n){"use strict";var i=t("prime"),r=t("./base"),o=(t("prime-util/prime/bound"),t("./grid")),a=t("elements"),s=t("elements/zen"),l=t("mout/function/bind"),u=t("mout/object/forOwn"),c=t("../../utils/get-ajax-url").config,d=t("../../utils/get-outline").getOutlineNameById,h=t("../../utils/translate");t("elements/insertion");i=new i({inherits:r,options:{},constructor:function(t){this.grid=new o,r.call(this,t),this.on("done",this.bound("onDone")),this.on("changed",this.hasChanged)},layout:function(){var t,e=c(this.getPageId()+"/layout/"+this.getType()+"/"+this.getId()),n="",i="";return this.hasInheritance()&&(t=d(this.inherit.outline),n=this.renderInheritanceLabel(t),i=" g-inheriting",this.inherit.include.length&&(i+=" g-inheriting-"+this.inherit.include.join(" g-inheriting-"))),'

'+this.getTitle()+'

'+n+"
"},adopt:function(t){a(t).insert(this.block.find(".g-grid"))},renderInheritanceLabel:function(t){t=h("GANTRY5_PLATFORM_INHERITING_FROM_X",""+t+"");return this.block&&this.getParent()&&(t=""),'
'+t+"
"},enableInheritance:function(){var t,e;this.hasInheritance()&&(this.block.attribute("class",this.cleanKlass(this.block.attribute("class"))),this.block.addClass("g-inheriting"),this.inherit.include.length&&this.block.addClass("g-inheriting-"+this.inherit.include.join(" g-inheriting-")),this.block.find("> .g-inherit")||(t=s("div"),e=d(this.inherit.outline),e=this.renderInheritanceLabel(e),t.html(e).children().after(this.block.find("> .section-header"))))},disableInheritance:function(){var t;!this.block.find("> .g-inherit")||(t=this.block.find("> .g-inherit.g-section-inherit"))&&t.remove(),this.block.attribute("class",this.cleanKlass(this.block.attribute("class"))),this.block.removeClass("g-inheriting")},refreshInheritance:function(){var t,e;this.block.attribute("class",this.cleanKlass(this.block.attribute("class"))),this.hasInheritance()&&(this.enableInheritance(),(t=this.block.find("> .g-inherit"))&&(e=d(this.inherit.outline),e=s("div").html(this.renderInheritanceLabel(e)),t&&e&&t.html(e.children().html())))},addInheritanceTip:function(t){var n,e=this.getInheritanceTip();return t&&(n="",u(e,function(t,e){n+="data-"+e+'="'+t+'" '}),e=n),this.hasInheritance()?e:""},getInheritanceTip:function(){var t=this.inherit?this.inherit.outline:null,e=d(t),n=(this.inherit.include||[]).join(", ");return{tip:h("GANTRY5_PLATFORM_INHERITING_FROM_X",""+e+"")+"
Outline ID: "+t+"
Replace: "+n,"tip-offset":-2,"tip-place":"top-right"}},cleanKlass:function(t){return(t=(t||"").split(" ")).filter(function(t){return!t.match(/^g-inheriting-/)}).join(" ")},hasChanged:function(t,e){var n=this.block.find("h4 > i:first-child");n&&e&&!e.changeState||(this.block[t?"addClass":"removeClass"]("block-has-changes"),!t&&n&&n.remove(),t&&!n&&s("i.far.fa-circle.changes-indicator").top(this.block.find("h4")))},onDone:function(t){this.block.search("[data-lm-id]")||(this.grid.insert(this.block,"bottom"),this.options.builder.add(this.grid));var e=this.block.find(".fa-plus");e&&e.on("click",l(function(t){return t&&t.preventDefault(),!this.block.find(".g-grid:last-child:empty")&&(this.grid=new o,this.grid.insert(this.block.find('[data-lm-blocktype="container"]')?this.block.find('[data-lm-blocktype="container"]'):this.block,"bottom"),void this.options.builder.add(this.grid))},this)),this.refreshInheritance()},getParent:function(){var t=this.block.parent("[data-lm-id]");return t?this.options.builder.get(t.data("lm-id")):null},getLimits:function(t){if(!t)return!1;t=t.block.nextSibling()||t.block.previousSibling()||!1;if(!t)return[100,100];t=this.options.builder.get(t.data("lm-id"));return"block"===t.getType()&&[5,this.getParent().getSize()+t.getSize()-5]}});e.exports=i},{"../../utils/get-ajax-url":71,"../../utils/get-outline":72,"../../utils/translate":78,"./base":12,"./grid":15,elements:113,"elements/insertion":114,"elements/zen":137,"mout/function/bind":192,"mout/object/forOwn":232,prime:301,"prime-util/prime/bound":297}],21:[function(t,e,n){"use strict";t=new(t("prime"))({inherits:t("./particle"),options:{type:"spacer",title:"Spacer",attributes:{}}});e.exports=t},{"./particle":18,prime:301}],22:[function(t,e,n){"use strict";t=new(t("prime"))({inherits:t("./particle"),options:{type:"system",attributes:{}}});e.exports=t},{"./particle":18,prime:301}],23:[function(t,e,n){"use strict";var i=t("prime"),r=t("./section"),o=t("../../utils/get-ajax-url").config,r=new i({inherits:r,options:{type:"wrapper",attributes:{name:"Wrapper"}},layout:function(){o(this.getPageId()+"/layout/"+this.getType()+"/"+this.getId());return'
'},hasChanged:function(){},getSize:function(){return!1},getId:function(){return this.id||(this.id=this.options.type)}});e.exports=r},{"../../utils/get-ajax-url":71,"./section":20,prime:301}],24:[function(t,e,n){"use strict";var i=t("prime"),s=t("elements"),r=t("prime/emitter"),o=t("./blocks/"),l=(t("mout/object/forOwn"),t("mout/collection/forEach")),a=t("mout/collection/size"),u=(t("mout/lang/isArray"),t("mout/array/flatten"),t("./id")),c=t("mout/object/set"),d=t("mout/object/unset"),h=t("mout/object/get"),p=t("mout/object/deepFillIn"),f=t("mout/object/omit");t("elements/attributes"),t("elements/traversal");t("mout/string/rpad"),t("mout/string/repeat");s.implement({empty:function(){return this.forEach(function(t){for(var e;e=t.firstChild;)t.removeChild(e)})}});r=new i({inherits:r,constructor:function(t){return t&&this.setStructure(t),this.map={},this},setStructure:function(t){try{this.structure="object"==typeof t?t:JSON.parse(t)}catch(t){console.error("Parsing error:",t)}},add:function(t){var e="string"==typeof t?t:t.id;c(this.map,e,t),t.isNew(!1)},remove:function(t){t="string"==typeof t?t:t.id,d(this.map,t)},get:function(t){var e="string"==typeof t?t:t.id;return h(this.map,e,t)},load:function(t){return this.recursiveLoad(t),this.emit("loaded",t),this},serialize:function(t,e){var n=[];if(t=t||s("[data-lm-root]")){var i,r,o,a,t=t.search((e?"":"> ")+"[data-lm-id]");return l(t,function(t){t=s(t),i=t.data("lm-id"),r=t.data("lm-blocktype"),o=t.data("lm-blocksubtype")||!1,a=t.search("> [data-lm-id]"),a=e?!!a&&a.map(function(t){return s(t).data("lm-id")}):a?this.serialize(t):[],a={id:i,type:r,subtype:o,title:h(this.map,i)?h(this.map,i).getTitle():"Untitled",attributes:h(this.map,i)?h(this.map,i).getAttributes():{},inherit:h(this.map,i)?h(this.map,i).getInheritance():{},children:a},e&&((t={})[i]=a,a=t),n.push(a)},this),n}},insert:function(t,e,n){var i=s("[data-lm-root]");if(i){o[e.type]||console[console.error?"error":"log"](e.type+" does not exist");e=new(o[e.type]||o.section)(p({id:t,attributes:{},inherit:{},subtype:e.subtype||!1,builder:this},f(e,"children")));return n?e.block.insert(s('[data-lm-id="'+n+'"]')):e.block.insert(i),"block"===e.getType()&&e.setSize(),this.add(e),e.emit("rendered",e,n?h(this.map,n):null),e}},reset:function(t){this.map={},this.setStructure(t||{}),s("[data-lm-root]").empty(),this.load()},cleanupLonely:function(){var e,n,i=[],t=s("[data-lm-root] > .g-section > .g-grid > .g-block .g-grid > .g-block, [data-lm-root] > .g-section > .g-grid > .g-block > .g-block");if(t)return t.forEach(function(t){return t=s(t),e=null,(!(n=t.parent().hasClass("g-grid"))||!t.siblings())&&(n&&(i.push(t.data("lm-id")),e=t.parent()),i.push(t.data("lm-id")),t.children().before(e||t),void(e||t).remove())}),i},recursiveLoad:function(t,n,i,r){t=t||this.structure,i=i||0,r=r||!1,n=n||this.insert,l(t,function(e){e.id||(e.id=u({builder:{map:this.map},type:e.type,subtype:e.subtype})),console&&console.log,this.emit("loading",n.call(this,e.id,e,r,i)),e.children&&a(e.children)&&(i++,l(e.children,function(t){this.recursiveLoad([t],n,i,e.id)},this)),this.get(e.id).emit("done",this.get(e.id)),i--},this)}});e.exports=r},{"./blocks/":16,"./id":27,elements:113,"elements/attributes":108,"elements/traversal":136,"mout/array/flatten":173,"mout/collection/forEach":189,"mout/collection/size":191,"mout/lang/isArray":203,"mout/object/deepFillIn":225,"mout/object/forOwn":232,"mout/object/get":233,"mout/object/omit":240,"mout/object/set":241,"mout/object/unset":244,"mout/string/repeat":266,"mout/string/rpad":269,prime:301,"prime/emitter":300}],25:[function(t,e,n){"use strict";var i=t("../ui/drag.events"),r=t("prime"),o=(t("prime/emitter"),t("prime-util/prime/bound")),a=t("prime-util/prime/options"),s=t("mout/function/bind"),l=t("mout/lang/isString"),c=t("mout/math/map"),d=t("mout/math/clamp"),h=t("mout/number/enforcePrecision"),u=t("mout/object/get"),p=t("../utils/elements.utils");t("elements/events"),t("elements/delegation");i=new r({mixin:[o,a],DRAG_EVENTS:i,options:{minSize:5},constructor:function(t,e){this.setOptions(e),this.history=this.options.history||{},this.builder=this.options.builder||{},this.origin={x:0,y:0,transform:null,offset:{x:0,y:0}}},getBlock:function(t){return u(this.builder.map,l(t)?t:p(t).data("lm-id")||"")},getAttribute:function(t,e){return this.getBlock(t).getAttribute(e)},getSize:function(t){return this.getAttribute(p(t),"size")},start:function(t,e,n,i){if(t&&t.type.match(/^touch/i)&&t.preventDefault(),window.G5.tips.hide(e[0]),t.which&&1!==t.which)return!0;t.preventDefault(),this.element=p(e),this.siblings={occupied:0,elements:n,next:this.element.nextSibling(),prevs:this.element.previousSiblings(),sizeBefore:0},1 [data-lm-id]:first-child")[0].getBoundingClientRect().left,this.origin.offset.parentRect.right=this.element.parent().find("> [data-lm-id]:last-child")[0].getBoundingClientRect().right,this.DRAG_EVENTS.EVENTS.MOVE.forEach(s(function(t){p(document).on(t,this.bound("move"))},this)),this.DRAG_EVENTS.EVENTS.STOP.forEach(s(function(t){p(document).on(t,this.bound("stop"))},this))},move:function(t){t&&t.type.match(/^touch/i)&&t.preventDefault();var e=t.clientX||t.touches[0].clientX||0,n=t.clientY||t.touches[0].clientY||0,i=this.origin.offset.parentRect,r=(this.lastX||e)-e,t=(this.lastY||n)-n;this.direction=(Math.abs(r)>Math.abs(t)&&0Math.abs(t)&&r<0&&"right")||Math.abs(t)>Math.abs(r)&&0 .g-block > [data-lm-blocktype]:not([data-lm-nodrag]) !> .g-block, .g5-lm-particles-picker [data-lm-blocktype], [data-lm-root] [data-lm-blocktype="section"] > [data-lm-blocktype="grid"]:not(:empty):not(.no-move):not([data-lm-nodrag]), [data-lm-root] [data-lm-blocktype="section"] > [data-lm-blocktype="container"] > [data-lm-blocktype="grid"]:not(:empty):not(.no-move):not([data-lm-nodrag]), [data-lm-root] [data-lm-blocktype="offcanvas"] > [data-lm-blocktype="grid"]:not(:empty):not(.no-move):not([data-lm-nodrag]), [data-lm-root] [data-lm-blocktype="offcanvas"] > [data-lm-blocktype="container"] > [data-lm-blocktype="grid"]:not(:empty):not(.no-move):not([data-lm-nodrag])',droppables:"[data-lm-dropzone]",exclude:".section-header .button, .section-header .fa, .lm-newblocks .float-right .button, [data-lm-nodrag], [data-lm-disabled]",resize_handles:"[data-lm-root] .g-grid > .g-block:not(:last-child)",builder:h,history:f,savestate:i}),e.exports.layoutmanager=p,u&&((n=JSON.parse(u.data("lm-root"))).name&&(n=n.layout),h.setStructure(n),h.load(),p.history.setSession(h.serialize(),JSON.parse(u.data("lm-preset"))),p.savestate.setSession(h.serialize(null,!0))),d.delegate("click",".g-tabs a",function(t,e){return t.preventDefault(),!1}),d.delegate("keydown",".g-tabs a",function(t,e){var n=t.which||t.keyCode;if(32==n||13==n)return t.preventDefault(),d.emit("mouseup",t),!1}),d.delegate("mouseup",".g-tabs a",function(t,n){n=m(n),t.preventDefault();var i=0,e=n.parent(".g-tabs"),t=e.siblings(".g-panes");e.search("a").forEach(function(t,e){t==n[0]&&(i=e+1)}),t.find("> .active").removeClass("active"),e.find("> ul > .active").removeClass("active"),t.find("> .g-pane:nth-child("+i+")").addClass("active"),e.find("> ul > li:nth-child("+i+")").addClass("active"),t.search("> [aria-expanded]")&&t.search("> [aria-expanded]").attribute("aria-expanded","false"),e.search("> [aria-expanded]")&&e.search("> [aria-expanded]").attribute("aria-expanded","false"),t.find("> .g-pane:nth-child("+i+")").attribute("aria-expanded","true"),e.find("> ul >li:nth-child("+i+") [aria-expanded]")&&e.find("> ul > li:nth-child("+i+") > [aria-expanded]").attribute("aria-expanded","true")}),d.delegate("statechangeBefore","[data-g5-lm-picker]",function(){v.close()}),d.on("statechangeAfter",function(t,e){return!(u=m("[data-lm-root]"))||(n=JSON.parse(u.data("lm-root")),h.setStructure(n),h.load(),p.refresh(),p.history.setSession(h.serialize(),JSON.parse(u.data("lm-preset"))),p.savestate.setSession(h.serialize(null,!0)),p.eraser.element=m("[data-lm-eraseblock]"),void p.eraser.hide(!0))}),d.delegate("input",".sidebar-block .search input",function(t,e){var n,i,r=m(e).value().toLowerCase(),e=m(".sidebar-block [data-lm-blocktype]");if(!e)return!1;e.style({display:"none"}).forEach(function(t){t=m(t),i=t.data("lm-blocktype").toLowerCase(),n=s(t.text()).toLowerCase(),i.substr(0,r.length)!=r&&!n.match(r)||t.style({display:"block"})},this)}),["click","touchend"].forEach(function(t){d.delegate(t,"[data-lm-samewidth]:not(:empty)",function(t,e){window.G5.tips.hide(e[0]);var n,i,r=e[0].getBoundingClientRect();(t.clientX||t.pageX||t.changedTouches[0].pageX||0) [data-lm-blocktype="block"]'))&&1!=n.length&&(n.forEach(function(t){i=m(t).data("lm-id"),h.get(i).setSize(100/n.length,!0)}),f.push(h.serialize(),f.get().preset))})}),d.delegate("mouseover","[data-lm-samewidth]:not(:empty)",function(t,e){var n=e[0].getBoundingClientRect(),i=t.clientX||t.touches&&t.touches[0].clientX||0,t=i+5>n.width+n.left,n=i-5=o&&parseFloat(s.value())<=a?"":O("GANTRY5_PLATFORM_JS_LM_SIZE_LIMITS_RANGE"))})),r.on("click",function(t){t.preventDefault();var a=m(t.currentTarget);a.disabled(!0),a.hideIndicator(),a.showIndicator();t=e.elements.content.find("form")[0].elements,t=g(t,e.elements.content);if(t.invalid.length)return a.disabled(!1),a.hideIndicator(),a.showIndicator("fa fa-fw fa-exclamation-triangle"),void b.error(O("GANTRY5_PLATFORM_JS_REVIEW_FIELDS"),O("GANTRY5_PLATFORM_JS_INVALID_FIELDS"));y(i.attribute("method"),C(i.attribute("action")+S()),t.valid.join("&")||{},function(t,e){var n,i,r,o;e.body.success?(i=null,(n=h.get(u)).setAttributes(e.body.data.options),n.hasAttribute("enabled")&&n[n.getAttribute("enabled")?"enable":"disable"](),"section"!==n.getType()&&(n.setTitle(e.body.data.title||"Untitled"),n.updateTitle(n.getTitle())),"position"===n.getType()&&n.updateKey(),e.body.data.block&&x(e.body.data.block)&&(r=(i=h.get(c)).block.nextSibling()||i.block.previousSibling(),o=i.getSize(),i.setAttributes(e.body.data.block),o=o-i.getSize(),i.setAnimatedSize(i.getSize()),r&&(r=h.get(r.data("lm-id"))).setAnimatedSize(parseFloat(r.getSize())+o,!0)),e.body.data.inherit&&(delete e.body.data.inherit.section,n.setInheritance(e.body.data.inherit),n.enableInheritance(),n.refreshInheritance()),e.body.data.children&&(p.clear(n.block,{save:!1,dropLastGrid:!!e.body.data.children.length,emptyInherits:!0}),h.recursiveLoad(e.body.data.children,h.insert,0,n.getId())),n.hasInheritance()&&!e.body.data.inherit&&(n.setInheritance({}),n.disableInheritance()),f.push(h.serialize(),f.get().preset),null===a.data("apply-and-save")||(o=m("body").find(".button-save"))&&d.emit("click",{target:o}),v.close(),b.success(O("GANTRY5_PLATFORM_JS_PARTICLE_SETTINGS_APPLIED",n.getTitle()),O("GANTRY5_PLATFORM_JS_SETTINGS_APPLIED"))):v.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),a.hideIndicator()})})}else v.enableCloseByOverlay()}})})}),e.exports={$:m,builder:h,layoutmanager:p,history:f,savestate:i}},{"../fields/submit":9,"../ui":54,"../ui/popover":56,"../utils/field-validation":68,"../utils/flags-state":69,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"../utils/history":75,"../utils/save-state":77,"../utils/translate":78,"./builder":24,"./history":26,"./inheritance":29,"./layoutmanager":30,"./particles-sidebar":31,agent:80,"elements/attributes":108,"elements/domready":111,"elements/zen":137,"mout/array/contains":166,"mout/collection/size":191,"mout/number/enforcePrecision":222,"mout/string/properCase":264,"mout/string/replace":267,"mout/string/trim":272}],29:[function(t,e,n){"use strict";var b=t("elements"),i=t("elements/domready"),o=t("agent"),y=t("../../ui").modal,w=t("mout/lang/isArray"),x=t("mout/collection/forEach"),a=t("mout/object/filter"),s=t("mout/object/keys"),k=t("mout/collection/contains"),l=t("../../utils/get-ajax-suffix"),S=t("../../utils/get-ajax-url").parse,C=t("../../utils/get-ajax-url").global,T=(t("../../utils/get-outline").getOutlineNameById,t("../../utils/get-outline").getCurrentOutline),E={attributes:["g-settings-particle","g-settings-atom"],block:{panel:"g-settings-block-attributes",tab:"g-settings-block"},particles:"g-inherit-particle",atoms:"g-inherit-atom"};i(function(){var m=b("body"),g={},v={};m.delegate("change",'[name="inherit[outline]"]',function(t,e){var n=e.parent(".settings-param").find(".settings-param-title"),i=e.siblings().find(".g-item"),u=e.value(),c=b('[name="inherit[section]"]')?b('[name="inherit[section]"]').value():"",d=e.parent("[data-g-inheritance-settings]"),h=b('[data-multicheckbox-field="inherit[include]"]:checked')||[],p={list:b("#g-inherit-particle, #g-inherit-atom"),mode:b('[name="inherit[mode]"]:checked'),radios:b('[name="inherit[particle]"], [name="inherit[atom]"]'),checked:b('[name="inherit[particle]"]:checked, [name="inherit[atom]"]:checked')};if(!i)return!0;var f=g[c]!==u||v[c]!==p.mode.value();f&&!u&&h.forEach(function(t){b(t).checked(!1),m.emit("change",{target:t})});var r=JSON.parse(d.data("g-inheritance-settings")),i={outline:u||T(),type:r.type||"",subtype:r.subtype||"",mode:p.mode.value(),inherit:u&&"inherit"===p.mode.value()?"1":"0"};i.id=r.id,n.showIndicator(),e.selectizeInstance.blur(),p.radios&&p.checked&&(f||(i.selected=p.checked.value(),i.id=p.checked.value(),p.list=!1));e="atom"===i.type?"atoms":"layouts",e=p.list?e+"/list":e;o("POST",S(C(e)+l()),i,function(t,e){var r,o,a,s,l;n.hideIndicator(),e.body.success?(r=e.body,o=d.find('[name="inherit[include]"]').value().split(","),a=d.search('[data-multicheckbox-field="inherit[include]"]').map(function(t){return b(t).value()}),s=y.getByID(y.getLast()),x(E,function(t,i){t=t.panel||t,(t=w(t)?t:[t]).forEach(function(t){var e=k(o,i),n=k(a,i);(e||!n)&&r.html[t]&&(l=s.find("#"+t))&&(l.html(r.html[t]),(t=l.search("[data-selectize]"))&&t.selectize())})}),f&&h&&""===g[c]&&h.forEach(function(t){m.emit("change",{target:t})}),g[c]=u,v[c]=p.mode.value()):y.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}})})}),m.delegate("change","#g-settings-inheritance [data-multicheckbox-field]",function(t,o){if(!(a=b('[name="inherit[outline]"]')))return!0;var a=a.value(),e=o.value(),s=o.checked(),l=t.noRefresh,u={mode:b('[name="inherit[mode]"]:checked'),radios:b('[name="inherit[particle]"], [name="inherit[atom]"]'),checked:b('[name="inherit[particle]"]:checked, [name="inherit[atom]"]:checked')},c={panel:E[e]&&E[e].panel||E[e],tab:E[e]&&E[e].tab||E[e]};w(c.panel)||(c.panel=[c.panel],c.tab=[c.tab]),c.panel.forEach(function(t,e){var n=b("#"+t),i=b("#"+c.tab[e]+"-tab");if(!n||!i)return!0;var r=n.find(".g-inherit"),t="clone"===u.mode.value(),e=function(t){t||m.emit("change",{target:o.parent(".settings-block").find('[name="inherit[outline]"]')})};s&&a&&!t?((n=i.find(".fa-unlock"))&&n.removeClass("fa-unlock").addClass("fa-lock"),r&&r.show(),e(l)):((i=i.find(".fa-lock"))&&i.removeClass("fa-lock").addClass("fa-unlock"),r&&r.hide(),t&&e(l))})}),m.delegate("change",'[name="inherit[mode]"], [name="inherit[particle]"], [name="inherit[atom]"]',function(t,e){var n=y.getByID(y.getLast()),i=n.find('[name="inherit[outline]"]'),n=n.search("[data-multicheckbox-field]")||[],r=!1;"inherit[mode]"===e.attribute("name")&&(r=!0),m.emit("change",{target:i,noRefresh:r}),n.forEach(function(t){m.emit("change",{target:t,noRefresh:r})})}),m.delegate("click","#g-inherit-particle .fa-info-circle, #g-inherit-atom .fa-info-circle",function(t,e){t.preventDefault();var n=y.getByID(y.getLast()).find('[name="inherit[outline]"]'),t=e.siblings('input[name="inherit[particle]"], input[name="inherit[atom]"]');if(!t||!n)return!1;e="inherit[atom]"===t.name()?"atoms/instance":"layouts/particle";return y.open({content:"Loading",method:"post",data:{id:t.value(),outline:n.value()||T()},remote:S(C(e)+l()),remoteLoaded:function(t,e){t.body.success||y.enableCloseByOverlay()}}),!1}),m.delegate("mouseup",".g-tabs .fa-lock, .g-tabs .fa-unlock",function(t,e){if(!e.parent("li").hasClass("active"))return!1;var n=y.getByID(y.getLast()),i=e.hasClass("fa-lock"),r=e.parent("a").id().replace(/\-tab$/,""),e=s(a(E,function(t){return t===r||t.tab===r||k(t,r)})||[]).shift(),n=n.find('[data-multicheckbox-field][value="'+e+'"]'),e={mode:b('[name="inherit[mode]"]:checked'),radios:b('[name="inherit[particle]"], [name="inherit[atom]"]'),checked:b('[name="inherit[particle]"]:checked, [name="inherit[atom]"]:checked')};if(n){if("clone"===e.mode.value()||e.radios&&!e.checked)return!1;n.checked(!i),m.emit("change",{target:n})}})})},{"../../ui":54,"../../utils/get-ajax-suffix":70,"../../utils/get-ajax-url":71,"../../utils/get-outline":72,agent:80,elements:113,"elements/domready":111,"mout/collection/contains":187,"mout/collection/forEach":189,"mout/lang/isArray":203,"mout/object/filter":229,"mout/object/keys":236}],30:[function(t,e,n){"use strict";var i=t("prime"),f=t("../utils/elements.utils"),c=t("mout/function/bind"),u=t("elements/zen"),r=t("prime/emitter"),o=t("prime-util/prime/bound"),a=t("prime-util/prime/options"),m=t("./blocks"),s=t("../ui/drag.drop"),l=t("../ui/eraser"),d=t("../utils/flags-state"),h=t("./drag.resizer"),g=t("mout/object/get"),p=t("mout/object/keys"),v=(t("mout/array/every"),t("mout/number/enforcePrecision")),b=(t("mout/lang/isArray"),t("mout/lang/deepEquals")),y=t("mout/collection/find"),w=(t("mout/lang/isObject"),t("mout/array/contains")),x=t("mout/collection/forEach"),k={disable:function(){var t=f('[data-lm-root] [data-lm-blocktype="grid"]');t&&t.removeClass("no-hover")},enable:function(){var t=f('[data-lm-root] [data-lm-blocktype="grid"]');t&&t.addClass("no-hover")},cleanup:function(e,n,t){t=t?t.search("> .g-grid:empty"):f('[data-lm-blocktype="section"] > .g-grid:empty, [data-lm-blocktype="container"] > .g-grid:empty, [data-lm-blocktype="offcanvas"] > .g-grid:empty');t&&t.forEach(function(t){((t=f(t)).nextSibling("[data-lm-id]")||n)&&(e.remove(t.data("lm-id")),t.remove())})}},r=new i({mixin:[o,a],inherits:r,options:{},constructor:function(t,e){this.setOptions(e),(this.refElement=t)&&f(t)&&this.init(t)},init:function(){this.dragdrop=new s(this.refElement,this.options),this.resizer=new h(this.refElement,this.options),this.eraser=new l("[data-lm-eraseblock]",this.options),this.dragdrop.on("dragdrop:start",this.bound("start")).on("dragdrop:location",this.bound("location")).on("dragdrop:nolocation",this.bound("nolocation")).on("dragdrop:resize",this.bound("resize")).on("dragdrop:stop:erase",this.bound("removeElement")).on("dragdrop:stop",this.bound("stop")).on("dragdrop:stop:animation",this.bound("stopAnimation")),this.builder=this.options.builder,this.history=this.options.history,this.savestate=this.options.savestate||null,k.disable()},refresh:function(){this.refElement&&f(this.refElement)&&this.init()},singles:function(t,e,n,i){k[t](e,n,i)},clear:function(t,n){var i,r,o=t?(t.search("[data-lm-id]")||[]).map(function(t){return f(t).data("lm-id")}):[];n=n||{save:!0,dropLastGrid:!1,emptyInherits:!1},x(this.builder.map,function(t,e){o.length&&!w(o,e)||!n.emptyInherits&&t.block.parent(".g-inheriting")||(i=t.getType(),r=(r=t.block.find("> [data-lm-id]"))&&r.data("lm-blocktype"),w(["particle","spacer","position","widget","system","block"],i)&&"block"==i&&r&&"section"!==r&&"container"!==r?(this.builder.remove(e),t.block.remove()):!n.emptyInherits||"section"!=i&&"offcanvas"!=i&&"container"!=i||t.hasInheritance&&(t.inherit={},t.disableInheritance()))},this),this.singles("cleanup",this.builder,n.dropLastGrid,t),n.save&&this.history.push(this.builder.serialize(),this.history.get().preset)},updatePendingChanges:function(){var e,n,i,r,o=this.savestate.getData(),a=this.builder.serialize(null,!0),t=b(o,a),s=f('[data-save="Layout"]'),l=(s.find("i"),s.find(".changes-indicator"));t&&l&&s.hideIndicator(),t||l||s.showIndicator("changes-indicator far fa-fw fa-circle"),d.set("pending",!t),a.forEach(function(t){r=p(t)[0],n=y(o,function(t){return t[r]}),i=y(a,function(t){return t[r]}),e=!b(n,i),(r=this.builder.get(r))&&r.emit("changed",e)},this)},start:function(t,e){var n=f("[data-lm-root]"),i=f(e).position(),r=f(e)[0].getBoundingClientRect();this.block=null,this.mode=n.data("lm-root")||"page",n.addClass("moving");var o,a=f(e).data("lm-blocktype"),s=e[0].cloneNode(!0);this.placeholder||(this.placeholder=u("div.block.placeholder[data-lm-placeholder]")),this.placeholder.style({display:"none"}),s=f(s),this.original=s.after(e).style({display:s.hasClass("g-grid")?"flex":"block",opacity:.5}).addClass("original-placeholder").data("lm-dropzone",null),"grid"===a&&this.original.style({display:"flex"}),this.originalType=a,this.block=g(this.builder.map,e.data("lm-id")||"")||new m[a]({builder:this.builder,subtype:e.data("lm-subtype"),title:e.text()}),this.block.isNew()?(s=e.position(),this.original.style({position:"fixed",opacity:.5}).style({left:r.left,top:r.top,width:s.width,height:s.height}),this.element=this.dragdrop.element,this.dragdrop.element=this.original):(e.style({position:"fixed",zIndex:2500,opacity:.5,margin:0,width:Math.ceil(i.width),height:Math.ceil(i.height),left:r.left,top:r.top}).find("[data-lm-blocktype]"),"grid"!==this.block.getType()||(r=this.block.block.siblings(":not(.original-placeholder):not(.section-header):not(.g-inherit):not(:empty)"))&&r.search("[data-lm-id]").style({"pointer-events":"none"}),this.placeholder.before(e),this.eraser.show()),"grid"===a&&(o=n.search('[data-lm-dropzone]:not([data-lm-blocktype="grid"])'))&&o.style({"pointer-events":"none"}),k.enable()},location:function(t,e,n){n=f(n),(this.block.isNew()?this.element:this.original).style({transform:"translate(0, 0)"}),this.placeholder||(this.placeholder=u("div.block.placeholder[data-lm-placeholder]").style({display:"none"}));var i=n.data("lm-blocktype"),r=this.block.getType();if(!i&&n.data("lm-root")&&(i="root"),!("page"!==this.mode&&"section"===i||"grid"===i&&(n.parent().data("lm-root")||"container"===n.parent().data("lm-blocktype")&&n.parent().parent().data("lm-root")))){var o=':not(.placeholder):not([data-lm-id="'+this.original.data("lm-id")+'"])',a={before:this.original.previousSiblings(o),after:this.original.nextSiblings(o)};if(a.before&&(a.before=f(a.before[0])),a.after&&(a.after=f(a.after[0])),!("block"===i&&(a.before===n&&"after"===e.x||a.after===n&&"before"===e.x)||"grid"===i&&(a.before===n&&"below"===e.y||a.after===n&&"above"===e.y))){var s,o=n.parent('[data-lm-blocktype="atoms"]'),a=this.block.block.find("[data-lm-id]");if("atom"==(a?a.data("lm-blocktype"):r)){if(!o)return}else if(o)return;switch(i){case"root":case"section":break;case"grid":var l=!n.children(":not(.placeholder)");if("grid"!==r&&!l)return;l?"grid"===r?this.placeholder.before(n):this.placeholder.bottom(n):(s="above"===e.y?"before":"after",this.placeholder[s](n));break;case"block":s="above"===e.y?"top":"bottom",s="other"===e.x?s:e.x,this.placeholder[s](n)}this.placeholder.removeClass("in-between").removeClass("in-between-grids").removeClass("in-between-grids-first").removeClass("in-between-grids-last"),this.placeholder.style({display:"block"})["block"!==i?"removeClass":"addClass"]("in-between"),"grid"===r&&"grid"===i&&(o=this.placeholder.nextSibling(),i=this.placeholder.previousSibling(),this.placeholder.addClass("in-between-grids"),i&&!i.data("lm-blocktype")&&this.placeholder.addClass("in-between-grids-first"),o&&o.data("lm-blocktype")||this.placeholder.addClass("in-between-grids-last"))}}},nolocation:function(t){(this.block.isNew()?this.element:this.original).style({transform:"translate(0, 0)"}),this.placeholder&&this.placeholder.remove(),this.block&&(t=t.type.match(/^touch/i)?document.elementFromPoint(t.touches.item(0).clientX,t.touches.item(0).clientY):t.target,this.block.isNew()||((t=f(t)).matches(this.eraser.element)||this.eraser.element.find(t)?(this.dragdrop.removeElement=!0,this.eraser.over()):(this.dragdrop.removeElement=!1,this.eraser.out())))},resize:function(t,e,n,i){this.resizer.start(t,e,n,i)},removeElement:function(t,e){this.dragdrop.removeElement=!1;e.animate({opacity:0},{duration:"150ms"});var n,e=f("[data-lm-root]");"grid"===this.block.getType()&&(n=e.search('[data-lm-dropzone]:not([data-lm-blocktype="grid"])'))&&n.style({"pointer-events":"inherit"});var i,r,o,a,s,l=this.block.block.siblings(":not(.original-placeholder)");l&&"block"==this.block.getType()&&(i=(u=this.block.getSize())/l.length,a=0,l.forEach(function(t,e){t=f(t),o=g(this.builder.map,t.data("lm-id")),e+1==l.length&&(s=o),r=v(o.getSize()+i,0),a+=r,o.setSize(r,!0)},this),100!=a&&s&&(u=s.getSize(),i=100-a,s.setSize(u+i,!0))),this.eraser.hide(),this.dragdrop.DRAG_EVENTS.EVENTS.MOVE.forEach(c(function(t){f("body").off(t,this.dragdrop.bound("move"))},this)),this.dragdrop.DRAG_EVENTS.EVENTS.STOP.forEach(c(function(t){f("body").off(t,this.dragdrop.bound("deferStop"))},this)),this.builder.remove(this.block.getId());var u=this.block.block.search("[data-lm-id]");u&&u.length&&u.forEach(function(t){this.builder.remove(f(t).data("lm-id"))},this),this.block.block.remove(),this.placeholder&&this.placeholder.remove(),this.original&&this.original.remove(),this.element=this.block=null,k.disable(),k.cleanup(this.builder),this.history.push(this.builder.serialize(),this.history.get().preset),e.removeClass("moving")},stop:function(t,e){var n,i,r,o,a,s,l,u,c,d,h,p=f(this.dragdrop.lastOvered);p&&p.matches(this.eraser.element.find(".trash-zone"))?this.eraser.hide():("grid"!==this.block.getType()||(s=this.block.block.siblings(":not(.original-placeholder):not(.section-header):not(.g-inherit):not(:empty)"))&&s.search("[data-lm-id]").style({"pointer-events":"inherit"}),this.block.isNew()||this.eraser.hide(),this.dragdrop.matched?(e=f(e),n=!1,i=this.block.isNew(),r=this.block.getType(),p=!!(o=e.data("lm-id"))&&(g(this.builder.map,o)?g(this.builder.map,o).getType():e.data("lm-blocktype")),(o=this.placeholder.parent())&&(e=o.data("lm-id"),o=!!g(this.builder.map,e||"")&&g(this.builder.map,e).getType(),e=!1,this.original.remove(),"block"!==r&&"grid"!==r&&("section"===p||"grid"===p||"block"===p&&"block"!==o)&&(a=new m.block({builder:this.builder}).adopt(this.block.block),o=new m[r]({id:this.block.block.data("lm-id"),type:r,subtype:this.element.data("lm-blocksubtype"),title:this.element.text(),builder:this.builder}).setLayout(this.block.block),a.setSize(),this.block=a,this.builder.add(a),this.builder.add(o),o.emit("rendered",o,a),a.emit("rendered",a,null),e={case:1}),"block"===this.originalType&&"block"===this.block.getType()&&(e={case:3},a=this.block.block.parent('[data-lm-blocktype="grid"]'),this.placeholder.parent('[data-lm-blocktype="grid"]')!==a&&(n={from:this.block.block.siblings(":not(.placeholder)"),to:this.placeholder.siblings(":not(.placeholder)")}),a=(a=a.find('!> [data-lm-blocktype="container"]')?a.parent():a).siblings(":not(.original-placeholder)"),!this.block.isNew()&&a.length&&this.resizer.evenResize(a),this.block.block.attribute("style",null),this.block.setSize()),"grid"!==r||s||(s=this.block.block.parent('[data-lm-blocktype="section"]').find(".fa-plus"))&&s.emit("click"),this.block.hasAttribute("size")&&"function"==typeof this.block.getSize&&this.block.setSize(this.placeholder.compute("flex")),this.block.insert(this.placeholder),this.placeholder.remove(),i&&(e&&this.resizer.evenResize(f([this.block.block,this.block.block.siblings()])),this.element.attribute("style",null)),(n.from||n.to&&n.to!=this.block.block)&&(l=this.block.getSize(),n.to||this.block.setSize(100,!0),n.from&&(c=l/n.from.length,d=0,n.from.forEach(function(t){t=f(t),u=g(this.builder.map,t.data("lm-id")),h=u.getSize()+c,u.setSize(h,!0),d+=h},this),100!==d&&(c=(100-d)/n.from.length,n.from.forEach(function(t){t=f(t),u=g(this.builder.map,t.data("lm-id")),h=u.getSize()+c,u.setSize(h,!0)},this))),n.to&&(l=100/(n.to.length+1),n.to.forEach(function(t){t=f(t),(u=g(this.builder.map,t.data("lm-id"))).setSize(l,!0)},this),this.block.setSize(l,!0))),k.disable(),k.cleanup(this.builder),this.history.push(this.builder.serialize(),this.history.get().preset))):this.placeholder&&this.placeholder.remove())},stopAnimation:function(t){var e,n,i=f("[data-lm-root]");i.removeClass("moving"),this.original&&this.original.remove(),k.disable(),this.block||(this.block=g(this.builder.map,t.data("lm-id"))),this.block&&"block"===this.block.getType()&&this.block.setSize(),this.block&&this.block.isNew()&&this.element&&this.element.attribute("style",null),"grid"===this.originalType&&(e=i.search('[data-lm-dropzone]:not([data-lm-blocktype="grid"])'))&&e.forEach(function(t){t=f(t),n=g(this.builder.map,t.data("lm-id")),t.attribute("style",null),n.setSize()},this)}});e.exports=r},{"../ui/drag.drop":51,"../ui/eraser":53,"../utils/elements.utils":66,"../utils/flags-state":69,"./blocks":16,"./drag.resizer":25,"elements/zen":137,"mout/array/contains":166,"mout/array/every":169,"mout/collection/find":188,"mout/collection/forEach":189,"mout/function/bind":192,"mout/lang/deepEquals":201,"mout/lang/isArray":203,"mout/lang/isObject":208,"mout/number/enforcePrecision":222,"mout/object/get":233,"mout/object/keys":236,prime:301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],31:[function(t,e,n){"use strict";function i(){(o=g(".sidebar-block"))&&(a=o.find(".g5-lm-particles-picker"))&&(r=a.find("> .search"),s=a.find("> .particles-container"),l=window.innerHeight,p=a[c=u=0].getBoundingClientRect(),f=a.position().top,d=g("body.admin.com_gantry5 nav.navbar-fixed-top, #wpadminbar, #admin-main #titlebar, #admin-main .grav-update.grav"),h=g("body.admin.com_gantry5 #status"),d&&g(d).forEach(function(t){u+=t.offsetHeight}),h&&g(h).forEach(function(t){c+=t.offsetHeight}),s.style({"max-height":l-u-c-r[0].offsetHeight-30,overflow:"auto"}),s[0].scrollHeight!==s[0].offsetHeight&&s.addClass("has-scrollbar").style({"margin-right":-b()}))}var o,a,r,s,l,u,c,d,h,p,f,m=t("elements/domready"),g=t("elements"),v=t("../utils/decouple"),b=t("../utils/get-scrollbar-width");m(function(){i();function t(){var t,e,n,i,r;o&&a&&(i=this.scrollY||this.scrollTop,r=(t=o[0].getBoundingClientRect()).top+t.height,e=a[0].getBoundingClientRect(),n=i>p.top-u-10&&f-10<=i,i=e.height+10+u+parseInt(o.compute("padding-bottom"),10)>=r,r=t.height<=e.height,a.style("width",e.width),n&&!i?(a.removeClass("particles-absolute").addClass("particles-fixed"),a.style({top:u+10,bottom:"inherit"})):n&&i?(r||"grav"===GANTRY_PLATFORM&&t.bottom input[type="checkbox"]'):null)||p(t.data("override-target"));!e||t.disabled()||r&&!r.checked()||"radio"==n&&!t.checked()||(k(t)||a.push(t),o[e]=i)})}if(a.length)return n.disabled(!1),n.hideIndicator(),n.showIndicator("fa fa-fw fa-exclamation-triangle"),void b.error(E("GANTRY5_PLATFORM_JS_REVIEW_FIELDS"),E("GANTRY5_PLATFORM_JS_INVALID_FIELDS"));"other"==s&&p(".settings-param-title, .card.settings-block > h4").hideIndicator(),d.emit("updateOriginalFields"),f("post",l,o,function(t,e){e.body.success?(v.close(),p("#styles")&&(r="
"+(e.body.warning?"
"+e.body.title+"
"+e.body.html:E("GANTRY5_PLATFORM_JS_CSS_COMPILED"))),b[e.body.warning?"warning":"success"](m(h,{verb:"s"==i.slice(-1)?"have":"has",type:i,extras:r}),i+" "+E("GANTRY5_PLATFORM_SAVED"))):v.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),n.disabled(!1),n.hideIndicator(),n.forEach(function(t){p(t).lastSaved=new Date}),"layout"==s&&S.layoutmanager.updatePendingChanges(),x.set("pending",!1),x.emit("update:pending")})}),d.delegate("keydown","[data-title-edit]",function(t,e){var n=t.which||t.keyCode;32!=n&&13!=n||(t.preventDefault(),d.emit("click",t))}),d.delegate("click","[data-title-edit]",function(t,e){if((e=p(e)).hasClass("disabled"))return!1;var n=e.siblings("[data-title-editable]")||e.previousSiblings().find("[data-title-editable]")||e.nextSiblings().find("[data-title-editable]");if(!n)return!0;i=n[0],n.text(g(n.text())),n.attribute("contenteditable",!0),i.focus();var i,e=document.createRange();e.selectNodeContents(i),(i=window.getSelection()).removeAllRanges(),i.addRange(e),n.storedTitle=g(n.text()),n.titleEditCanceled=!1,n.emit("title-edit-start",n.storedTitle)}),d.delegate("keydown","[data-title-editable]",function(t,e){switch(e=p(e),t.keyCode){case 13:case 27:return t.stopPropagation(),27==t.keyCode&&void 0!==e.storedTitle&&(e.text(e.storedTitle),e.titleEditCanceled=!0),e.attribute("contenteditable",null),e[0].blur(),e.emit("title-edit-exit",e.data("title-editable"),13==t.keyCode?"enter":"esc"),!1;default:return!0}}),d.delegate("blur","[data-title-editable]",function(t,e){(e=p(e))[0].scrollLeft=0,e.attribute("contenteditable",null),e.data("title-editable",g(e.text())),window.getSelection().removeAllRanges(),e.emit("title-edit-end",e.data("title-editable"),e.storedTitle,e.titleEditCanceled)},!0),d.delegate("click","[data-ajax-action]",function(t,e){t&&t.preventDefault&&t.preventDefault();var n=e.attribute("href")||e.data("ajax-action"),t=e.data("ajax-action-method")||"post",i=p(e.data("ajax-action-indicator"))||e;if(!n)return!1;i.showIndicator(),f(t,y(n+w()),function(t,e){return e.body.success?(b[e.body.warning?"warning":"success"](e.body.html||"Action successfully completed.",e.body.title||""),void i.hideIndicator()):(v.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),i.hideIndicator(),!1)})})});t={lm:S,mm:C,assingments:t("./assignments"),ui:t("./ui"),styles:t("./styles"),$:p,domready:t("elements/domready"),particles:t("./particles"),zen:t("elements/zen"),moofx:t("moofx"),atoms:t("./pagesettings"),tips:t("./ui/tooltips")};window.G5=t,e.exports=t},{"./assignments":3,"./changelog":4,"./configurations":6,"./fields":7,"./lm":28,"./menu":35,"./pagesettings":37,"./particles":43,"./positions":48,"./positions/cards":47,"./styles":49,"./ui":54,"./ui/popover":56,"./ui/tooltips":61,"./utils/ajaxify-links":62,"./utils/field-validation":68,"./utils/flags-state":69,"./utils/get-ajax-suffix":70,"./utils/get-ajax-url":71,"./utils/rAF-polyfill":76,"./utils/translate":78,agent:80,elements:113,"elements/attributes":108,"elements/delegation":110,"elements/domready":111,"elements/events":112,"elements/insertion":114,"elements/traversal":136,"elements/zen":137,moofx:138,"mout/queryString/setParam":249,"mout/string/interpolate":261,"mout/string/trim":272}],33:[function(t,e,n){"use strict";var i=t("../ui/drag.events"),r=t("prime"),o=(t("prime/emitter"),t("prime-util/prime/bound")),a=t("prime-util/prime/options"),s=t("mout/function/bind"),l=t("mout/lang/isString"),c=t("mout/math/map"),d=t("mout/math/clamp"),h=t("mout/number/enforcePrecision"),u=t("mout/object/get"),p=t("../utils/elements.utils");t("elements/events"),t("elements/delegation");i=new r({mixin:[o,a],DRAG_EVENTS:i,options:{minSize:5},constructor:function(t,e,n){this.setOptions(e),this.history=this.options.history||{},this.builder=this.options.builder||{},this.map=this.builder.map,this.menumanager=n,this.origin={x:0,y:0,transform:null,offset:{x:0,y:0}}},getBlock:function(t){return u(this.map,l(t)?t:p(t).data("lm-id")||"")},getAttribute:function(t,e){return this.getBlock(t).getAttribute(e)},getSize:function(t){t=((t=p(t)).matches("[data-mm-id]")?t:t.parent("[data-mm-id]")).find(".percentage input");return Number(t.value())},setSize:function(t,e,n){n=void 0!==n&&n;var i=(t=p(t)).matches("[data-mm-id]")?t:t.parent("[data-mm-id]"),t=i.find(".percentage input");i[n?"animate":"style"]({flex:"0 1 "+e+"%"}),t.value(h(e,1))},start:function(t,e,n,i){if(t&&t.type.match(/^touch/i)&&t.preventDefault(),t.which&&1!==t.which)return!0;t.preventDefault(),this.element=p(e);e=this.element.parent(".submenu-selector");if(!e)return!1;e.addClass("moving"),this.siblings={occupied:0,elements:n,next:this.element.parent("[data-mm-id]").nextSibling().find("> .submenu-column"),prevs:this.element.parent("[data-mm-id]").previousSiblings(),sizeBefore:0},1 [data-mm-id]:first-child")[0].getBoundingClientRect().left,this.origin.offset.parentRect.right=this.element.parent(".submenu-selector").find("> [data-mm-id]:last-child")[0].getBoundingClientRect().right,this.DRAG_EVENTS.EVENTS.MOVE.forEach(s(function(t){p(document).on(t,this.bound("move"))},this)),this.DRAG_EVENTS.EVENTS.STOP.forEach(s(function(t){p(document).on(t,this.bound("stop"))},this))},move:function(t){t&&t.type.match(/^touch/i)&&t.preventDefault();var e=t.clientX||t.touches[0].clientX||0,n=t.clientY||t.touches[0].clientY||0,i=this.origin.offset.parentRect,r=(this.lastX||e)-e,t=(this.lastY||n)-n;this.direction=(Math.abs(r)>Math.abs(t)&&0Math.abs(t)&&r<0&&"right")||Math.abs(t)>Math.abs(r)&&0 [data-mm-id]"),i=[],e=p(".menu-selector .active"),e=e?e.data("mm-id"):null;return n.forEach(function(t){i.push(this.getSize(t))},this),this.menumanager.items[e].columns=i,this.updateMaxValues(t),i},updateMaxValues:function(t){var n,i,e=this.element?this.element.parent(".submenu-selector"):null;if(!e&&!t)return!1;(t||e.search("> [data-mm-id]")).forEach(function(t){var e=(t=p(t)).nextSibling()||t.previousSibling();e&&(i={block:t.find("input.column-pc"),sibling:e.find("input.column-pc")},(n={current:this.getSize(t),sibling:this.getSize(e)}).total=n.current+n.sibling,i.block.attribute("max",n.total-Number(i.block.attribute("min"))),i.sibling.attribute("max",n.total-Number(i.sibling.attribute("min"))))},this)},evenResize:function(t,e){var n=t.length,i=h(100/n,4);t.forEach(function(t){t=p(t),this.setSize(t,i,void 0!==e&&e)},this),this.updateItemSizes(t),this.menumanager.emit("dragEnd",this.menumanager.map,"evenResize")}});e.exports=i},{"../ui/drag.events":52,"../utils/elements.utils":66,"elements/delegation":110,"elements/events":112,"mout/function/bind":192,"mout/lang/isString":211,"mout/math/clamp":216,"mout/math/map":218,"mout/number/enforcePrecision":222,"mout/object/get":233,prime:301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],34:[function(t,e,n){"use strict";function h(t,e){for(var n="",i=0,r="a"==(e=e&&e.toLowerCase())?10:0,o="n"==e?10:62;i++ ul").appendChild(o.children()),S.serialize(l),S.updatePendingChanges(),v.success(k("GANTRY5_PLATFORM_JS_POSITIONS_SETTINGS_APPLIED"),k("GANTRY5_PLATFORM_JS_SETTINGS_APPLIED"))}else g.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}});g.close(),u.hideIndicator(),C(n)})})})})}),e.exports=function(t,e){var n;this.isNewParticle&&"reorder"!==e||(this.resizer.updateItemSizes(),T=this,n=p("[data-save]"),e={settings:this.settings,ordering:this.ordering,items:this.items},this.isNewParticle||(a(t,e)?(n.hideIndicator(),r.set("pending",!1)):(n.showIndicator("far fa-fw changes-indicator fa-circle"),r.set("pending",!0))),this.isParticle&&this.isNewParticle&&(n=this.block.data("mm-blocktype"),this.block.attribute("data-mm-blocktype",null).addClass("g-menu-item-"+n).data("mm-original-type",n),f("span.menu-item-type.badge").text(n).after(this.block.find(".menu-item .title")),g.open({content:k("GANTRY5_PLATFORM_JS_LOADING"),method:"post",remote:w(p(this.block).find(".config-cog").attribute("href")+x()),remoteLoaded:function(t,e){var n=e.elements.content.find(".search input"),i=e.elements.content.search("[data-mm-type]"),r=e.elements.content.search("[data-mm-filter]");n&&r&&i&&(n.on("input",function(){var e,n;this.value()?(i.addClass("hidden"),e=[],n=this.value().toLowerCase(),r.forEach(function(t){t=p(t),o(t.data("mm-filter")).toLowerCase().match(new RegExp("^"+n+"|\\s"+n,"gi"))&&e.push(t.matches("[data-mm-type]")?t:t.parent("[data-mm-type]"))},this),e.length&&p(e).removeClass("hidden")):i.removeClass("hidden")}),setTimeout(function(){n[0].focus()},5))}})),this.type=void 0)}},{"../fields/submit":9,"../positions/cards":47,"../ui":54,"../utils/flags-state":69,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"../utils/translate":78,"../utils/wp-widgets-customizer":79,agent:80,elements:113,"elements/domready":111,"elements/zen":137,"mout/array/indexOf":175,"mout/lang/deepEquals":201,"mout/string/trim":272}],35:[function(t,e,n){"use strict";var h,i=t("elements/domready"),r=t("./menumanager"),p=t("../fields/submit"),f=t("elements"),m=t("elements/zen"),g=t("../ui").modal,v=t("../ui").toastr,o=t("./extra-items"),b=t("agent"),y=t("mout/string/trim"),a=t("mout/math/clamp"),s=t("mout/array/contains"),l=t("mout/array/indexOf"),w=t("../utils/get-ajax-url").parse,x=t("../utils/get-ajax-suffix"),k=t("../utils/translate"),t=-1 section ul li, .submenu-column, .submenu-column li[data-mm-id], .column-container .g-block",droppables:"#menu-editor [data-mm-id]",exclude:"[data-lm-nodrag], .menu-item-back, .fa-cog, .config-cog",resize_handles:".submenu-column:not(:last-child)",catchClick:!0})).on("dragEnd",o),(e.exports.menumanager=h).setRoot(),d.delegate("statechangeAfter","#main-header [data-g5-ajaxify], select.menu-select-wrap",function(){h.setRoot(),h.refresh(),h.eraser&&(h.eraser.element=f("[data-mm-eraseparticle]"),h.eraser.hide())}),d.delegate(u,".percentage input",function(t,e){(e=f(e)).currentSize=Number(e.value()),e[0].focus(),e[0].select()},!0),d.delegate("keydown",".percentage input",function(t){s([46,8,9,27,13,110,190],t.keyCode)||65==t.keyCode&&(!0===t.ctrlKey||!0===t.ctrlKey)||82==t.keyCode&&(!0===t.ctrlKey||!0===t.metaKey)||35<=t.keyCode&&t.keyCode<=40||(t.shiftKey||t.keyCode<48||57 [data-mm-id]")),h.emit("dragEnd",h.map,"inputChange"))}),d.delegate(c,".percentage input",function(t,e){e=f(e);var n=Number(e.value());(nNumber(e.attribute("max")))&&e.value(e.currentSize)},!0),d.delegate("click",".add-column",function(t,e){t&&t.preventDefault&&t.preventDefault();var n=(e=f(e)).parent("[data-g5-menu-columns]").find(".submenu-selector"),i=n.children(),t=n.find("> :last-child"),e=i?i.length:0,n=f(".menu-selector .active"),n=n?n.data("mm-id"):null;if(1==e&&!i.search(".submenu-items > [data-mm-id]"))return!1;i=f(t[0].cloneNode(!0));i.data("mm-id","list-"+e),i.find(".submenu-items").empty(),i.find("[data-mm-base-level]").data("mm-base-level",1),i.find(".submenu-level").text("Level 1"),i.after(t),h.ordering[n]||(h.ordering[n]=[[]]),h.ordering[n].push([]),h.resizer.evenResize(f(".submenu-selector > [data-mm-id]"))}),["click","touchend"].forEach(function(t){d.delegate(t,"[data-g5-menu-columns] .submenu-items:empty",function(t,e){var n=e[0].getBoundingClientRect(),i=t.pageX||t.changedTouches[0].pageX||0,r=t.pageY||t.changedTouches[0].pageY||0,o=36,a=36;if((t=f(".submenu-selector > [data-mm-id]")).length<=1)return!1;i>=n.left+n.width-o&&i<=n.left+n.width&&Math.abs(window.scrollY-r)-n.top [data-mm-id]"),h.ordering[a].splice(e,1),h.resizer.evenResize(t))})}),d.delegate("click","#menu-editor .config-cog, #menu-editor .global-menu-settings",function(t,u){t.preventDefault();var t={},c=u.hasClass("global-menu-settings");c?t.settings=JSON.stringify(h.settings):t.item=JSON.stringify(h.items[u.parent("[data-mm-id]").data("mm-id")]),g.open({content:k("GANTRY5_PLATFORM_JS_LOADING"),method:"post",data:t,overlayClickToClose:!1,remote:w(f(u).attribute("href")+x()),remoteLoaded:function(t,e){if(t.body.success){var o,n=e.elements.content.find("form"),i=m("div").html(t.body.html).find("form"),r=e.elements.content.search('input[type="submit"], button[type="submit"], [data-apply-and-save]'),a=e.elements.content.find(".search input"),s=e.elements.content.search("[data-mm-type]"),l=e.elements.content.search("[data-mm-filter]"),t=e.elements.content.find(".g-urltemplate");t&&d.emit("input",{target:t});t=e.elements.content.find("[data-title-editable]");if(t&&t.on("title-edit-end",function(t,e){if(!(t=y(t)))return t=y(e)||"Title",this.text(t).data("title-editable",t),!0}),a&&l&&s&&a.on("input",function(){var e,n;this.value()?(s.addClass("hidden"),e=[],n=this.value().toLowerCase(),l.forEach(function(t){t=f(t),y(t.data("mm-filter")).toLowerCase().match(new RegExp("^"+n+"|\\s"+n,"gi"))&&e.push(t.matches("[data-mm-type]")?t:t.parent("[data-mm-type]"))},this),e.length&&f(e).removeClass("hidden")):s.removeClass("hidden")}),a&&setTimeout(function(){a[0].focus()},5),!n&&!i||!r)return!0;r.on("click",function(t){t.preventDefault();var r=f(t.currentTarget);r.disabled(!0),r.hideIndicator(),r.showIndicator();t=p(i[0].elements,e.elements.content,{isRoot:c});if(t.invalid.length)return r.disabled(!1),r.hideIndicator(),r.showIndicator("fa fa-fw fa-exclamation-triangle"),void v.error(k("GANTRY5_PLATFORM_JS_REVIEW_FIELDS"),k("GANTRY5_PLATFORM_JS_INVALID_FIELDS"));b(i.attribute("method"),w(i.attribute("action")+x()),t.valid.join("&"),function(t,e){var n,i;e.body.success?(e.body.path||e.body.item&&"particle"==e.body.item.type?(o=e.body.path||u.parent("[data-mm-id]").data("mm-id"),h.items[o]=e.body.item):e.body.item&&"particle"==e.body.item.type||(h.settings=e.body.settings),!e.body.html||(n=u.parent("[data-mm-id]"))&&(i=e.body.item.enabled||e.body.item.options.particle.enabled,n.html(e.body.html),n["0"==i?"addClass":"removeClass"]("g-menu-item-disabled")),h.emit("dragEnd",h.map),null===r.data("apply-and-save")||(i=f("body").find(".button-save"))&&d.emit("click",{target:i}),g.close(),v.success(k("GANTRY5_PLATFORM_JS_MENU_SETTINGS_APPLIED"),k("GANTRY5_PLATFORM_JS_SETTINGS_APPLIED"))):g.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),r.hideIndicator()})})}else g.enableCloseByOverlay()}})})}),e.exports={menumanager:h}},{"../fields/submit":9,"../ui":54,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"../utils/translate":78,"./extra-items":34,"./menumanager":36,agent:80,elements:113,"elements/domready":111,"elements/zen":137,"mout/array/contains":166,"mout/array/indexOf":175,"mout/math/clamp":216,"mout/string/trim":272}],36:[function(t,e,n){"use strict";var i=t("prime"),d=t("../utils/elements.utils"),r=t("mout/function/bind"),l=t("elements/zen"),o=t("prime/emitter"),a=t("prime-util/prime/bound"),s=t("prime-util/prime/options"),u=t("../ui/drag.drop"),c=t("../ui/eraser"),h=t("./drag.resizer"),p=(t("mout/object/get"),t("mout/string/ltrim")),f=(t("mout/array/every"),t("mout/array/last")),m=t("mout/array/indexOf"),g=(t("mout/lang/isArray"),t("mout/lang/isObject"),t("mout/lang/deepClone")),o=(t("mout/object/equals"),new i({mixin:[a,s],inherits:o,options:{},constructor:function(t,e){this.setOptions(e),this.refElement=t,this.map={},t&&d(t)&&this.init(t)},init:function(){this.setRoot(),this.dragdrop=new u(this.refElement,this.options,this),this.resizer=new h(this.refElement,this.options,this),this.eraser=new c("[data-mm-eraseparticle]",this.options),this.dragdrop.on("dragdrop:click",this.bound("click")).on("dragdrop:start",this.bound("start")).on("dragdrop:move:once",this.bound("moveOnce")).on("dragdrop:location",this.bound("location")).on("dragdrop:nolocation",this.bound("nolocation")).on("dragdrop:resize",this.bound("resize")).on("dragdrop:stop:erase",this.bound("removeElement")).on("dragdrop:stop",this.bound("stop")).on("dragdrop:stop:animation",this.bound("stopAnimation"))},refresh:function(){this.refElement&&d(this.refElement)&&this.init()},setRoot:function(){var t,e;this.root=d("#menu-editor"),this.root&&(this.settings=JSON.parse(this.root.data("menu-settings")),this.ordering=JSON.parse(this.root.data("menu-ordering")),this.items=JSON.parse(this.root.data("menu-items")),this.map={settings:g(this.settings),ordering:g(this.ordering),items:g(this.items)},t=d("[data-g5-menu-columns] .submenu-selector"),this.resizer&&t&&(e=t.search("> [data-mm-id]"))&&this.resizer.updateMaxValues(e))},click:function(t,e){t=d(t.target);if(t.matches(".g-menu-addblock")||t.parent(".g-menu-addblock"))return!1;if(e.hasClass("g-block"))return this.stopAnimation(),!0;e.find("[data-g5-ajaxify]")&&(t=e.siblings(),e.addClass("active"),t&&t.removeClass("active")),e.emit("click");e=e.find("a");e&&e[0].click()},resize:function(t,e,n,i){this.resizer.start(t,e,n,i)},start:function(t,e){var n=e.parent(".menu-selector")||e.parent(".submenu-column")||e.parent(".submenu-selector")||e.parent(".g5-mm-particles-picker"),i=d(e).position(),r=d(e)[0].getBoundingClientRect();this.block=null,this.targetLevel=void 0,this.addNewItem=!1,this.type=e.parent(".g-toplevel")||e.matches(".g-toplevel")?"main":e.matches(".g-block")?"column":"columns_items",this.isParticle=e.matches("[data-mm-blocktype]")||e.matches("[data-mm-original-type]"),this.wasActive=e.hasClass("active"),this.isNewParticle=e.parent(".g5-mm-particles-picker"),this.ParticleIndex=-1,this.root=n,this.Element=e,this.itemID=e.data("mm-id"),this.itemLevel=e.data("mm-level"),this.itemFrom=e.parent("[data-mm-id]"),this.itemTo=null,this.isParticle&&!this.isNewParticle&&(a=e.parent().children("[data-mm-id]"),this.ParticleIndex=m(a,e[0])),n.addClass("moving");var o=d(e).data("mm-id"),a=e[0].cloneNode(!0);this.placeholder||(this.placeholder=l(("column"==this.type?"div":"li")+".block.placeholder[data-mm-placeholder]")),this.placeholder.style({display:"none"}),this.original=d(a).after(e).style({display:"inline-block",opacity:1}).addClass("original-placeholder").data("lm-dropzone",null),this.originalType=o,this.block=e,this.isNewParticle?(o=e.position(),this.original.style({position:"fixed",opacity:.5}).style({left:r.left,top:r.top,width:o.width,height:o.height}),this.element=this.dragdrop.element,this.block=this.dragdrop.element,this.dragdrop.element=this.original):(e.style({position:"fixed",zIndex:1500,width:Math.ceil(i.width),height:Math.ceil(i.height),left:r.left,top:r.top}).addClass("active"),this.placeholder.before(e)),"column"==this.type&&n.search(".g-block > *").style({"pointer-events":"none"})},moveOnce:function(t){t=d(t),this.original&&this.original.style({opacity:.5}),this.isNewParticle||!t.hasClass("g-menu-removable")&&!this.isParticle||this.eraser.show()},location:function(t,e,n){n=d(n),(this.isNewParticle?this.block:this.original).style({transform:"translate(0, 0)"}),this.placeholder||(this.placeholder=l(("column"==this.type?"div":"li")+".block.placeholder[data-mm-placeholder]").style({display:"none"}));var i=n.parent(".g-toplevel")||n.matches(".g-toplevel")?"main":n.matches(".g-block")?"column":"columns_items",r=n.data("mm-level"),o=this.block.data("mm-level");if(!this.isParticle||"main"!=i||r){if(null===r&&"columns_items"===this.type&&this.isParticle&&this.isNewParticle)return(a=n.find(".submenu-items"))?(this.placeholder.style({display:"block"}).bottom(a),this.addNewItem=a,this.targetLevel=2,void(this.dragdrop.matched=!1)):void(this.dragdrop.matched=!1);if(null===r&&("columns_items"===this.type||this.isParticle)){var a,s=(a=n.find(".submenu-items")).data("mm-base-level");return!n.hasClass("g-block")||n.find(this.block)||!this.isParticle&&o!=s&&(!a||a.children()||2 *").style({"pointer-events":"none"}),this.eraser.hide(),this.dragdrop.DRAG_EVENTS.EVENTS.MOVE.forEach(r(function(t){d("body").off(t,this.dragdrop.bound("move"))},this)),this.dragdrop.DRAG_EVENTS.EVENTS.STOP.forEach(r(function(t){d("body").off(t,this.dragdrop.bound("deferStop"))},this));var n=this.block,i=n.parent("[data-mm-base]").data("mm-base"),e=(n.parent("[data-mm-id]").data("mm-id").match(/\d+$/)||[0])[0],n=m(n.parent().children("[data-mm-id]:not(.original-placeholder)"),n[0]);delete this.items[this.itemID],this.ordering[i][e].splice(n,1),this.block.remove(),this.original.remove(),this.root.removeClass("moving"),this.root.find(".submenu-items")&&(this.root.find(".submenu-items").children()||this.root.find(".submenu-items").text("")),this.emit("dragEnd",this.map,"reorder")},stop:function(t,e,n){e=d(e);var i=d(this.dragdrop.lastOvered);if(i&&i.matches(this.eraser.element.find(".trash-zone")))this.eraser.hide();else{if(e&&n.removeClass("active"),"column"==this.type&&this.root.search(".g-block > *").attribute("style",null),!this.dragdrop.matched&&!this.addNewItem)return this.placeholder&&this.placeholder.remove(),this.type=void 0,this.targetLevel=!1,this.isParticle=void 0,void this.eraser.hide();if(!this.placeholder.parent())return this.type=void 0,this.targetLevel=!1,void(this.isParticle=void 0);this.addNewItem&&this.block.attribute("style",null).removeClass("active");i=this.block.parent();this.eraser.hide(),this.original&&(this.isNewParticle?this.original.attribute("style",null).removeClass("original-placeholder"):this.original.remove()),this.block.after(this.placeholder),this.placeholder.remove(),this.itemTo=this.block.parent("[data-mm-id]"),this.currentLevel=this.itemLevel,this.wasActive&&n.addClass("active"),this.isParticle&&(a=f(this.itemID.split("/")),o=(e||this.itemTo)[e&&!e.hasClass("g-block")?"parent":"find"]("[data-mm-base]").data("mm-base"),this.itemID=o?o+"/"+a:a,this.itemLevel=this.targetLevel,this.block.data("mm-id",this.itemID).data("mm-level",this.targetLevel));var r,o,a,s,l,u,c=this.itemID.split("/");c.splice(this.itemLevel-1),c=c.join("/"),(this.itemFrom||this.itemTo)&&((this.itemFrom==this.itemTo?[this.itemFrom]:[this.itemFrom,this.itemTo]).forEach(function(t){t&&(u=t.search("[data-mm-id]"),r=Number(2 [data-mm-id]")).forEach(function(t,e){var n=(t=d(t)).data("mm-id"),i=Number((n.match(/\d+$/)||[0])[0]);t.data("mm-id",n.replace(/\d+$/,""+e)),s.push(this.ordering[l][i])},this),this.ordering[l]=s),i.children()||i.empty();i=this.block.parent(".submenu-selector");i&&this.resizer.updateItemSizes(i.search("> [data-mm-id]")),this.emit("dragEnd",this.map,"reorder")}},stopAnimation:function(){var t=null;"column"==this.type&&(t=this.resizer.getSize(this.block)),this.root&&this.root.removeClass("moving"),this.block&&(this.block.attribute("style",null),t&&this.block.style("flex","0 1 "+t+" %")),this.original&&(this.isNewParticle&&(this.dragdrop.matched||this.targetLevel)?this.original.attribute("style",null).removeClass("original-placeholder"):this.original.remove()),!this.wasActive&&this.block&&this.block.removeClass("active")}}));e.exports=o},{"../ui/drag.drop":51,"../ui/eraser":53,"../utils/elements.utils":66,"./drag.resizer":33,"elements/zen":137,"mout/array/every":169,"mout/array/indexOf":175,"mout/array/last":179,"mout/function/bind":192,"mout/lang/deepClone":200,"mout/lang/isArray":203,"mout/lang/isObject":208,"mout/object/equals":227,"mout/object/get":233,"mout/string/ltrim":263,prime:301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],37:[function(i,l,t){!function(S){!function(){"use strict";function n(t){t&&(t.SimpleSort||s.createSortables(t))}var d=i("elements"),t=i("elements/domready"),h=i("elements/zen"),p=i("../fields/submit"),f=i("../ui").modal,m=i("../ui").toastr,e=i("../ui/eraser"),g=i("agent"),v=i("mout/array/indexOf"),r=i("sortablejs"),b=(i("mout/string/trim"),i("mout/object/size")),y=i("../utils/get-ajax-url").parse,w=i("../utils/get-ajax-suffix"),x=i("../utils/get-outline").getOutlineNameById,k=i("../utils/translate"),a='[name="page[head][atoms][_json]"]',o=[{name:"atoms",pull:"clone",put:!1},{name:"atoms",pull:!0,put:!0},{name:"atoms",pull:!1,put:!1}],s={eraser:null,lists:{picker:null,items:null},serialize:function(){var e=[],t=d(".atoms-list"),n=t.search("[data-atom-picked]");return n?(n.forEach(function(t){t=d(t),e.push(JSON.parse(t.data("atom-picked")))}),JSON.stringify(e).replace(/\//g,"\\/")):(t.empty(),"[]")},attachEraser:function(){s.eraser?s.eraser.element=d("[data-atoms-erase]"):s.eraser=new e("[data-atoms-erase]")},createSortables:function(n){var i;s.attachEraser(),o.forEach(function(t,e){i=d(e?1==e?".atoms-list":"#trash":".atoms-picker"),i=r.create(i[0],{sort:1==e,filter:"[data-atom-ignore]",group:t,scroll:!1,forceFallback:!0,animation:100,onStart:function(t){s.attachEraser(),d(t.item).addClass("atom-dragging"),d(t.from).hasClass("atoms-list")&&s.eraser.show()},onEnd:function(t){var e,n=d(t.item),i=d("#trash"),r=d(this.originalEvent.target),o=!1;if("touchend"===this.originalEvent.type&&(e=i[0].getBoundingClientRect(),o=((i=this.originalEvent).pageY||i.changedTouches[0].pageY)-window.scrollY<=e.height),r.matches("#trash")||r.parent("#trash")||o)return n.remove(),s.eraser.hide(),void this.options.onSort();n.removeClass("atom-dragging"),d(t.from).hasClass("atoms-list")&&s.eraser.hide()},onSort:function(){var t=s.serialize(),e=d(a);if(!e)throw new Error('Field "'+a+'" not found in the DOM.');e.value(t),d("body").emit("change",{target:e})},onOver:function(t){d(t.from).matches(".atoms-list")&&((t=d(t.newIndex)).matches("#trash")||t.parent("#trash")?s.eraser.over():s.eraser.out())}}),s.lists[e?"items":"picker"]=i,1==e&&(n.SimpleSort=i)})}};t(function(){var c,t=d("#atoms");d("body").delegate("mouseover","#atoms",function(t,e){n(e)}),n(t),(c=d("body")).delegate("click",".atoms-list [data-atom-picked] .config-cog",function(t,e){t&&t.preventDefault&&t.preventDefault();var t=e.parent("ul"),s=d(a),o=s.value(),l=t.search("> [data-atom-picked]"),u=e.parent("[data-atom-picked]"),t=u.data("atom-picked");f.open({content:k("GANTRY5_PLATFORM_JS_LOADING"),method:"post",data:{data:t},overlayClickToClose:!1,remote:y(e.attribute("href")+w()),remoteLoaded:function(t,e){var n=e.elements.content.find("form"),i=h("div").html(t.body.html).find("form"),r=e.elements.content.search('input[type="submit"], button[type="submit"], [data-apply-and-save]'),a=JSON.parse(o);if(1"+n+"")+"
ID: "+i+"
Replace: "+r)),c.emit("change",{target:s}),S.G5.tips.reload(),null===o.data("apply-and-save")||(r=d("body").find(".button-save"))&&c.emit("click",{target:r}),f.close(),m.success(k("GANTRY5_PLATFORM_JS_GENERIC_SETTINGS_APPLIED","Atom"),k("GANTRY5_PLATFORM_JS_SETTINGS_APPLIED"))):f.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),o.hideIndicator()})})}})})}),l.exports=s}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../fields/submit":9,"../ui":54,"../ui/eraser":53,"../utils/get-ajax-suffix":70,"../utils/get-ajax-url":71,"../utils/get-outline":72,"../utils/translate":78,agent:80,elements:113,"elements/domready":111,"elements/zen":137,"mout/array/indexOf":175,"mout/object/size":242,"mout/string/trim":272,sortablejs:316}],38:[function(t,e,n){"use strict";var i=t("elements/domready"),h=t("elements"),p=t("elements/zen"),f=t("../../fields/submit"),m=t("../../ui").modal,g=t("../../ui").toastr,v=t("agent"),l=t("mout/array/last"),b=t("mout/array/indexOf"),r=t("sortablejs"),u=t("mout/string/trim"),y=t("../../utils/get-ajax-url").parse,w=t("../../utils/get-ajax-suffix"),x=t("../../utils/translate");t("elements/insertion"),i(function(){function s(t,e){"enter"==e&&this.CollectionNew&&(this.CollectionNew=!1,d.emit("click",{target:this.parent(".settings-param").find("[data-collection-addnew]")})),"esc"==e&&this.CollectionNew&&(this.CollectionNew=!1,d.emit("click",{target:this.parent("[data-collection-item]").find("[data-collection-remove]")}))}function n(t){(t=t||h(".collection-list ul"))&&t.forEach(function(t){(t=h(t)).SimpleSort=r.create(t[0],{handle:".fa-reorder",filter:"[data-collection-nosort]",scroll:!1,animation:150,onStart:function(){h(this.el).addClass("collection-sorting")},onEnd:function(t){var e,n=h(this.el);n.removeClass("collection-sorting"),t.oldIndex!==t.newIndex&&(n=(e=n.parent(".settings-param").find("[data-collection-data]")).value(),(n=JSON.parse(n)).splice(t.newIndex,0,n.splice(t.oldIndex,1)[0]),e.value(JSON.stringify(n)),d.emit("change",{target:e}))}})})}var d=h("body");n(),d.delegate("mouseover",".collection-list ul",function(t,e){e.SimpleSort||n(e)}),d.delegate("click","[data-collection-addnew]",function(t,e){var n=e.parent(".settings-param"),i=n.find("ul"),r=i.parent("[data-field-name]").find("[data-collection-editall]"),o=n.find("[data-collection-data]"),a=n.find("[data-collection-template]"),e=i.search("> [data-collection-item]")||[],n=h(l(e)),a=h(a[0].cloneNode(!0));n?a.after(n):a.top(i),e.length&&r&&r.style("display","inline-block");i=(n=a.find("a")).find("[data-title-editable]"),r=new RegExp("%id%","g");n.href(n.href().replace(r,e.length)),a.attribute("style",null).data("collection-item",a.data("collection-template")),a.attribute("data-collection-template",null),a.attribute("data-collection-nosort",null),i.CollectionNew=!0,d.emit("click",{target:n.siblings("[data-title-edit]")}),i.on("title-edit-exit",s),d.emit("change",{target:o})}),d.delegate("blur","[data-collection-item] [data-title-editable]",function(t,e){var n=u(e.text()),i=e.parent("[data-collection-item]"),r=i.data("collection-item"),o=e.parent("ul").search("> [data-collection-item]"),a=e.parent(".settings-param").find("[data-collection-data]"),e=a.value(),i=b(o,i[0]);-1!=i&&((e=JSON.parse(e))[i]||e.splice(i,0,{}),e[i][r]=n,a.value(JSON.stringify(e)),d.emit("change",{target:a}))},!0),d.delegate("click","[data-collection-remove]",function(t,e){t&&t.preventDefault&&t.preventDefault();var n=e.parent("[data-collection-item]"),i=e.parent("ul"),r=i.parent("[data-field-name]").find("[data-collection-editall]"),o=i.search("> [data-collection-item]"),t=b(o,n[0]),i=e.parent(".settings-param").find("[data-collection-data]"),e=i.value();(e=JSON.parse(e)).splice(t,1),i.value(JSON.stringify(e)),n.remove(),o.length<=2&&r&&r.style("display","none"),d.emit("change",{target:i})}),d.delegate("click","[data-collection-duplicate]",function(t,e){t&&t.preventDefault&&t.preventDefault();var n=e.parent(".settings-param"),i=e.parent("[data-collection-item]"),r=e.parent("ul"),o=r.parent("[data-field-name]").find("[data-collection-editall]"),a=n.find("[data-collection-template]").find("a").href(),s=r.search("> [data-collection-item]"),t=b(s,i[0]),n=h(i[0].cloneNode(!0)).after(i),r=e.parent(".settings-param").find("[data-collection-data]"),i=r.value(),e=new RegExp("%id%","g");n.find("a").href(a.replace(e,s.length+1)),(i=JSON.parse(i)).splice(t,0,i[t]),r.value(JSON.stringify(i)),1<=s.length&&o.style("display","inline-block"),d.emit("change",{target:r})}),d.delegate("click","[data-collection-item] a",function(t,e){e.find("[contenteditable]")&&(t.preventDefault(),t.stopPropagation())}),d.delegate("click","[data-collection-item] .config-cog, [data-collection-editall]",function(t,a){t&&t.preventDefault&&t.preventDefault();var e=a.find("[data-title-editable]");if(e&&e.attribute("contenteditable"))return t.stopPropagation(),!1;var e=null!==a.data("collection-editall"),t=a.parent(".settings-param"),s=t.find("[data-collection-data]"),l=s.value(),u=a.parent("[data-collection-item]"),c=t.search("ul > [data-collection-item]"),t={data:e?l:JSON.stringify(JSON.parse(l)[b(c,u[0])])};m.open({content:x("GANTRY5_PLATFORM_JS_LOADING"),method:"post",className:"g5-dialog-theme-default g5-modal-collection g5-modal-collection-"+(e?"editall":"single"),data:t,overlayClickToClose:!1,remote:y(a.attribute("href")+w()),remoteLoaded:function(t,e){if(t.body.success){var n=e.elements.content.find("form"),r=p("div").html(t.body.html).find("form"),i=e.elements.content.search('input[type="submit"], button[type="submit"], [data-apply-and-save]'),o=JSON.parse(l);if(1 [data-collection-item]").forEach(function(t,e){var n=(t=h(t)).find("[data-title-editable]"),t=o[e][t.data("collection-item")];n.data("title-editable",t).text(t)}),null===i.data("apply-and-save")||(n=h("body").find(".button-save"))&&d.emit("click",{target:n}),m.close(),g.success(x("GANTRY5_PLATFORM_JS_GENERIC_SETTINGS_APPLIED","Collection"),x("GANTRY5_PLATFORM_JS_SETTINGS_APPLIED"))):m.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}}),i.hideIndicator()})})}else m.enableCloseByOverlay()}})})}),e.exports={}},{"../../fields/submit":9,"../../ui":54,"../../utils/get-ajax-suffix":70,"../../utils/get-ajax-url":71,"../../utils/translate":78,agent:80,elements:113,"elements/domready":111,"elements/insertion":114,"elements/zen":137,"mout/array/indexOf":175,"mout/array/last":179,"mout/string/trim":272,sortablejs:316}],39:[function(t,e,n){"use strict";var i=t("prime"),r=t("prime/emitter"),o=t("prime-util/prime/bound"),a=t("prime-util/prime/options"),h=t("elements"),s=t("elements/domready"),l=t("elements/zen"),u=t("../../ui/drag.events"),c=t("mout/collection/forEach"),d=t("mout/function/bind"),b=t("mout/math/clamp"),t=-1r.width&&(s=r.width),(l=l<0?0:l)>r.height&&(l=r.height),t.parent(".cp-mode-wheel")&&i.parent(".cp-grid")&&(a=75-s,e=75-l,r=Math.sqrt(a*a+e*e),(a=Math.atan2(e,a))<0&&(a+=2*Math.PI),75 div",d(function(t,e){if(e==this.tabs.transparent){this.opacity=0;var n=this.opacitySlider.position().height;return this.opacitySlider.find(".cp-picker").style({top:b(n-n*this.opacity,0,n)}),void this.move(this.opacitySlider,{manualOpacity:!0})}var i=o.find(".active"),r=i.attribute("class").replace(/\s|active|cp-tab-/g,""),n=e.attribute("class").replace(/\s|active|cp-tab-/g,"");this.wrapper.removeClass("cp-mode-"+r).addClass("cp-mode-"+n),i.removeClass("active"),e.addClass("active"),this.mode=n,this.updateFromInput()},this))},this)),this.wrapper.bottom("#g5-container"),this.built=!0,this.mode="hue"},updateFromInput:function(t,e){var n,i,r=(o=(e=h(e)||this.element).value()).replace(/\s/g,"").match(/^rgba?\([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},(.+)\)/),o=w(o)||o,r=r?b(r[1],0,1):1;if((n=y(o))||(n="#ffffff"),i=k(n),this.built){this.opacity=Math.max(r,0);var a=this.opacitySlider.position().height;this.opacitySlider.find(".cp-picker").style({top:b(a-a*this.opacity,0,a)});var s,l,u,c=this.grid.position().height,d=this.grid.position().width,a=this.slider.position().height;switch(this.mode){case"wheel":u=b(Math.ceil(.75*i.s),0,c/2),s=i.h*Math.PI/180,l=b(75-Math.cos(s)*u,0,d),u=b(75-Math.sin(s)*u,0,c),this.grid.style({backgroundColor:"transparent"}).find(".cp-picker").style({top:u,left:l}),u=150-i.b/(100/c),""===n&&(u=0),this.slider.find(".cp-picker").style({top:u}),this.slider.style({backgroundColor:x({h:i.h,s:i.s,b:100})});break;case"saturation":l=b(5*i.h/12,0,150),u=b(c-Math.ceil(i.b/(100/c)),0,c),this.grid.find(".cp-picker").style({top:u,left:l}),u=b(a-i.s*(a/100),0,a),this.slider.find(".cp-picker").style({top:u}),this.slider.style({backgroundColor:x({h:i.h,s:100,b:i.b})}),this.grid.find(".cp-grid-inner").style({opacity:i.s/100});break;case"brightness":l=b(5*i.h/12,0,150),u=b(c-Math.ceil(i.s/(100/c)),0,c),this.grid.find(".cp-picker").style({top:u,left:l}),u=b(a-i.b*(a/100),0,a),this.slider.find(".cp-picker").style({top:u}),this.slider.style({backgroundColor:x({h:i.h,s:i.s,b:100})}),this.grid.find(".cp-grid-inner").style({opacity:1-i.b/100});break;default:l=b(Math.ceil(i.s/(100/d)),0,d),u=b(c-Math.ceil(i.b/(100/c)),0,c),this.grid.find(".cp-picker").style({top:u,left:l}),u=b(a-i.h/(360/a),0,a),this.slider.find(".cp-picker").style({top:u}),this.grid.style({backgroundColor:x({h:i.h,s:100,b:100})})}}t||e.value(this.getValue(n)),this.emit("change",e,n,r)},updateFromPicker:function(t,e){var n,i,r,o,a=function(t,e){var n,i;return t.length&&e?(n=t[0].getBoundingClientRect().left,i=t[0].getBoundingClientRect().top,{x:n-e[0].getBoundingClientRect().left+t[0].offsetWidth/2,y:i-e[0].getBoundingClientRect().top+t[0].offsetHeight/2}):null},s=this.wrapper.find(".cp-grid"),l=this.wrapper.find(".cp-slider"),u=this.wrapper.find(".cp-opacity-slider"),c=s.find(".cp-picker"),d=l.find(".cp-picker"),h=u.find(".cp-picker"),p=a(c,s),f=a(d,l),a=a(h,u),m=s[0].getBoundingClientRect().width,g=s[0].getBoundingClientRect().height,v=l[0].getBoundingClientRect().height,h=u[0].getBoundingClientRect().height,u=this.element.value(),u=w(u)||u;if((n=y(u))||(n="#ffffff"),e.hasClass("cp-grid")||e.hasClass("cp-slider"))switch(this.mode){case"wheel":i=m/2-p.x,o=g/2-p.y,r=Math.sqrt(i*i+o*o),(o=Math.atan2(o,i))<0&&(o+=2*Math.PI),75>16,g:(65280&t)>>8,b:255&t}};s(function(){var t=new v,o=h("body");t.on("change",function(t,e,n){clearTimeout(this.timer);var i=C(e),r="dark"==(128<=(299*i.r+587*i.g+114*i.b)/1e3?"dark":"light")||!n||n<.35;n<1?(n="rgba("+i.r+", "+i.g+", "+i.b+", "+n+")",t.style({backgroundColor:n})):t.style({backgroundColor:e}),t.parent(".g-colorpicker")[r?"removeClass":"addClass"]("light-text"),this.timer=setTimeout(function(){t.emit("input"),o.emit("input",{target:t})},150)})}),e.exports=v},{"../../ui/drag.events":52,elements:113,"elements/domready":111,"elements/zen":137,"mout/collection/forEach":189,"mout/function/bind":192,"mout/math/clamp":216,prime:301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300}],40:[function(i,r,t){!function(w){!function(){"use strict";var d=i("../../utils/elements.utils"),t=i("prime"),o=i("agent"),a=i("elements/zen"),e=i("elements/domready"),h=i("mout/function/bind"),s=(i("mout/string/rtrim"),i("mout/lang/deepClone")),l=i("mout/object/deepFillIn"),p=i("../../ui").modal,f=i("../../utils/get-ajax-suffix"),m=i("../../utils/get-ajax-url").parse,g=i("../../utils/get-ajax-url").global,v=i("../../utils/translate"),b=i("../../utils/cookie"),y=i("dropzone").default,n=new t({constructor:function(t){t=t.data("g5-filepicker");this.data=!!t&&JSON.parse(t),this.data&&!this.data.value&&(this.data.value=d(this.data.field).value()),this.colors={error:"#D84747",success:"#9ADF87",small:"#aaaaaa",gradient:["#9e38eb","#4e68fc"]}},open:function(){this.data&&(this.data.value=d(this.data.field).value()),p.open({method:"post",data:this.data,content:v("GANTRY5_PLATFORM_JS_LOADING"),className:"g5-dialog-theme-default g5-modal-filepicker",remote:m(g("filepicker")+f()),remoteLoaded:h(this.loaded,this),afterClose:h(function(){this.dropzone&&this.dropzone.destroy()},this)})},getPath:function(){var t=this.content.search(".g-folders .active");return t?(t=d(t[t.length-1]),JSON.parse(t.data("folder")).pathname.replace(/\/$/,"")+"/"):null},getPreviewTemplate:function(){var t=a("li[data-file]"),e=(a("span.g-file-delete[data-g-file-delete][data-dz-remove]").html('').bottom(t),a("div.g-thumb[data-dz-thumbnail]").bottom(t));a("span.g-file-name[data-dz-name]").bottom(t),a("span.g-file-size[data-dz-size]").bottom(t),a("span.g-file-mtime[data-dz-mtime]").bottom(t);a("span.g-file-progress[data-file-uploadprogress]").html('').bottom(t),a("div").bottom(e),t.bottom("body");e=t[0].outerHTML;return t.remove(),e},loaded:function(t,e){var i=e.elements.content,u=(i.search(".g-bookmark"),i.find(".g-files")),n=s(this.data),c=this.colors,r=this;this.content=i,u&&(this.dropzone=new y("body",{previewTemplate:this.getPreviewTemplate(),previewsContainer:u.find("ul:not(.g-list-labels)")[0],thumbnailWidth:100,thumbnailHeight:100,clickable:"[data-upload]",acceptedFiles:this.acceptedFiles(this.data.filter)||"",accept:h(function(t,e){!this.data.filter||t.name.toLowerCase().match(this.data.filter)?e():e(""+t.name+" "+v("GANTRY5_PLATFORM_JS_FILTER_MISMATCH")+":
"+this.data.filter+"")},this),url:h(function(t){return m(g("filepicker/upload/"+w.btoa(encodeURIComponent(this.getPath()+t[0].name)))+f())},this)}),this.dropzone.on("thumbnail",function(t,e){var n=(n=t.name.split(".")).length&&1!=n.length?n.reverse()[0]:"-";d(t.previewElement).addClass("g-image g-image-"+n.toLowerCase()).find("[data-dz-thumbnail] > div").attribute("style","background-image: url("+encodeURI(e)+");")}),this.dropzone.on("addedfile",function(t){var e=d(t.previewElement),n=e.find("[data-file-uploadprogress]"),i=u.hasClass("g-filemode-list"),r={value:0,animation:!1,insertLocation:"bottom"},o=(o=t.name.split(".")).length&&1!=o.length?o.reverse()[0]:"-";t.type.match(/image.*/)?e.find(".g-thumb").addClass("g-image g-image-"+o.toLowerCase()):e.find(".g-thumb").text(o),r=l(i?{size:20,thickness:10,fill:{color:c.small,gradient:!1}}:{size:50,thickness:"auto",fill:{gradient:c.gradient,color:!1}},r),e.addClass("g-file-uploading"),n.progresser(r),n.attribute("title",v("GANTRY5_PLATFORM_JS_PROCESSING")).find(".g-file-progress-text").html("•••").attribute("title",v("GANTRY5_PLATFORM_JS_PROCESSING"))}).on("processing",function(t){d(t.previewElement).find("[data-file-uploadprogress]").find(".g-file-progress-text").text("0%").attribute("title","0%")}).on("sending",function(t,e,n){d(t.previewElement).find("[data-file-uploadprogress]").attribute("title","0%").find(".g-file-progress-text").text("0%").attribute("title","0%")}).on("uploadprogress",function(t,e,n){t=d(t.previewElement).find("[data-file-uploadprogress]");t.progresser({value:e/100}),t.attribute("title",Math.round(e)+"%").find(".g-file-progress-text").text(Math.round(e)+"%").attribute("title",Math.round(e)+"%")}).on("complete",function(t){r.refreshFiles(i)}).on("error",function(t,e){var n=d(t.previewElement),i=n.find("[data-file-uploadprogress]"),r=n.find(".g-file-progress-text"),t=u.hasClass("g-filemode-list");n.addClass("g-file-error"),i.title("Error").progresser({fill:{color:c.error,gradient:!1},value:1,thickness:t?10:25}),r.title("Error").html('').parent("[data-file-uploadprogress]").popover({content:e.html||(e.error&&e.error.message?e.error.message:e),placement:"auto",trigger:"mouse",style:"filepicker, above-modal",width:"auto",targetEvents:!1})}).on("success",function(t,e,n){var i=d(t.previewElement),r=i.find("[data-file-uploadprogress]"),o=i.find(".g-file-mtime"),a=i.find(".g-file-progress-text"),s=i.find(".g-thumb"),l=u.hasClass("g-filemode-list");r.progresser({fill:{color:c.success,gradient:!1},value:1,thickness:l?10:25}),a.html(''),setTimeout(h(function(){r.animate({opacity:0},{duration:500}),s.animate({opacity:1},{duration:500,callback:function(){i.data("file",JSON.stringify(e.finfo)).data("file-url",e.url).removeClass("g-file-uploading"),i.dropzone=t,r.remove(),o.text(v("GANTRY5_PLATFORM_JUST_NOW"))}})},this),500)})),i.delegate("click",".g-bookmark-title",function(t,e){t&&t.preventDefault&&t.preventDefault();var n=e.nextSibling(".g-folders"),i=e.parent(".g-bookmark");n&&n.slideToggle(function(){i.toggleClass("collapsed",n.gSlideCollapsed)})}),i.delegate("click","[data-folder]",h(function(t,r){t&&t.preventDefault&&t.preventDefault();var e=JSON.parse(r.data("folder")),t=d("[data-file].selected");n.root=e.pathname,n.value=!!t&&t.data("file-url"),n.subfolder=!0,r.showIndicator("fa fa-li fa-fw fa-spin-fast fa-spinner"),o(m(g("filepicker")+f()),n).send(h(function(t,e){var n,i;r.hideIndicator(),this.addActiveState(r),e.body.success?(e.body.subfolder&&(n=a("div").html(e.body.subfolder),(i=r.nextSibling())&&!i.attribute("data-folder")&&i.remove(),n.children().after(r)),e.body.files?(u.empty(),(n=a("div").html(e.body.files)).children().bottom(u).style({opacity:0}).animate({opacity:1},{duration:"250ms"})):u.find("> ul:not(.g-list-labels)").empty(),this.dropzone.previewsContainer=u.find("ul:not(.g-list-labels)")[0]):p.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}})},this))},this)),i.delegate("click","[data-g-file-preview]",h(function(t,e){t.preventDefault(),t.stopPropagation();e=e.parent("[data-file]");JSON.parse(e.data("file")).isImage&&(e=e.find(".g-thumb > div"),p.open({className:"g5-dialog-theme-default g5-modal-filepreview center",content:''}))},this)),i.delegate("click","[data-g-file-delete]",h(function(t,e){t.preventDefault();var n=e.parent("[data-file]"),t=JSON.parse(n.data("file")),e=m(g("filepicker/"+w.btoa(encodeURIComponent(t.pathname))+f()));if(!t.isInCustom)return!1;o("delete",e,function(t,e){e.body.success?(n.addClass("g-file-deleted"),setTimeout(function(){n.remove(),r.refreshFiles(i)},210)):p.open({content:e.body.html||e.body.message||e.body,afterOpen:function(t){e.body.html||e.body.message||t.style({width:"90%"})}})})},this)),i.delegate("click","[data-file]",h(function(t,e){t&&t.preventDefault&&t.preventDefault();var n=d(t.target),t=null!==n.data("g-file-delete")||n.parent("[data-g-file-delete]"),n=null!==n.data("g-file-preview")||n.parent("[data-g-file-preview]");e.hasClass("g-file-error")||e.hasClass("g-file-uploading")||t||n||(JSON.parse(e.data("file")),u.search("[data-file]").removeClass("selected"),e.addClass("selected"))},this)),i.delegate("click","[data-select]",h(function(t,e){t&&t.preventDefault&&t.preventDefault();t=u.find("[data-file].selected"),t=t?t.data("file-url"):"";d(this.data.field).value(t),d("body").emit("input",{target:this.data.field}),p.close()},this)),i.delegate("click","[data-files-mode]",h(function(t,e){t&&t.preventDefault&&t.preventDefault(),e.hasClass("active")||(d("[data-files-mode]").removeClass("active"),e.addClass("active"),b.write("g5_files_mode",e.data("files-mode")),u.animate({opacity:0},{duration:200,callback:function(){var n=e.data("files-mode"),t=u.search("[data-file-uploadprogress]"),i="list"==n?{size:20,thickness:10,fill:{color:c.small,gradient:!1}}:{size:50,thickness:"auto",fill:{gradient:c.gradient,color:!1}};u.attribute("class","g-files g-block g-filemode-"+n),t&&t.forEach(function(t){t=d(t);var e=s(i);t.parent(".g-file-error")&&(e.fill={color:c.error},e.value=1,e.thickness="list"==n?10:25),t.progresser(e)}),u.animate({opacity:1},{duration:200})}}))},this))},addActiveState:function(t){var e=this.content.search("[data-folder].active, .g-folders > .active"),n=t.parent();for(e&&e.removeClass("active"),t.addClass("active");"ul"==n.tag()&&!n.hasClass("g-folders");)n.previousSibling().addClass("active"),n=n.parent()},acceptedFiles:function(t){var e="";switch(t){case".(jpe?g|gif|png|svg)$":e=".jpg,.jpeg,.gif,.png,.svg,.JPG,.JPEG,.GIF,.PNG,.SVG";break;case".(mp4|webm|ogv|mov)$":e=".mp4,.webm,.ogv,.mov,.MP4,.WEBM,.OGV,.MOV"}return e},refreshFiles:function(t){var e=d("[data-folder].active"),e=e[e.length-1];e&&t.emit("click",{target:d(e)})}});e(function(){d("body").delegate("click","[data-g5-filepicker]",function(t,e){t&&t.preventDefault&&t.preventDefault(),(e=d(e)).GantryFilePicker||(e.GantryFilePicker=new n(e)),e.GantryFilePicker.open()})}),r.exports=n}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../ui":54,"../../utils/cookie":64,"../../utils/elements.utils":66,"../../utils/get-ajax-suffix":70,"../../utils/get-ajax-url":71,"../../utils/translate":78,agent:80,dropzone:107,"elements/domready":111,"elements/zen":137,"mout/function/bind":192,"mout/lang/deepClone":200,"mout/object/deepFillIn":225,"mout/string/rtrim":270,prime:301}],41:[function(t,e,n){"use strict";var i=t("prime"),s=t("../../utils/elements.utils"),a=t("elements/zen"),r=t("prime/map")(),o=t("prime/emitter"),l=t("prime-util/prime/bound"),u=(t("prime-util/prime/options"),t("elements/domready")),c=t("../../utils/decouple"),d=t("mout/function/bind"),h=(t("mout/array/map"),t("mout/array/forEach"),t("mout/array/contains")),p=(t("mout/array/last"),t("mout/array/split"),t("mout/array/removeAll")),f=t("mout/array/insert"),m=(t("mout/array/append"),t("mout/array/find"),t("mout/array/combine"),t("mout/array/intersection")),g=(t("mout/object/merge"),t("mout/string/unhyphenate")),v=t("mout/string/properCase"),b=t("mout/string/trim"),y=t("../../utils/get-ajax-suffix"),w=t("../../utils/get-ajax-url").parse,x=t("../../utils/get-ajax-url").global,k=t("../../ui").modal,S=t("../../utils/async-foreach"),C=t("../../utils/translate"),T=(t("agent"),t("webfontloader"));t("../../utils/elements.viewport");var E=new i({mixin:l,inherits:o,previewSentence:{latin:"Wizard boy Jack loves the grumpy Queen's fox.","latin-ext":"Wizard boy Jack loves the grumpy Queen's fox.",arabic:"نص حكيم له سر قاطع وذو شأن عظيم مكتوب على ثوب أخضر ومغلف بجلد أزرق",cyrillic:"В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!","cyrillic-ext":"В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!",devanagari:"एक पल का क्रोध आपका भविष्य बिगाड सकता है",greek:"Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός","greek-ext":"Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός",hebrew:"דג סקרן שט בים מאוכזב ולפתע מצא חברה",khmer:"ខ្ញុំអាចញ៉ាំកញ្ចក់បាន ដោយគ្មានបញ្ហា",telugu:"దేశ భాషలందు తెలుగు లెస్స",vietnamese:"Tôi có thể ăn thủy tinh mà không hại gì."},constructor:function(){this.wf=T,this.field=null,this.element=null,this.throttle=!1,this.selected=null,this.loadedFonts=[],this.filters={search:"",script:"latin",categories:[]}},open:function(t,e){e=e.data("g5-fontpicker");if(!e)throw new Error("No fontpicker data found");e=JSON.parse(e),this.field=s(e.field),k.open({content:C("GANTRY5_PLATFORM_JS_LOADING"),className:"g5-dialog-theme-default g5-modal-fonts",remote:w(x("fontpicker")+y()),remoteLoaded:d(function(t,e){var n=e.elements.content;this.attachEvents(n),this.updateCategories(n),this.search(),this.scroll(n.find("ul.g-fonts-list")),this.updateTotal(),this.selectFromValue(),setTimeout(function(){n.find(".particle-search-wrapper input")[0].focus()},5)},this)})},scroll:function(n){clearTimeout(this.throttle),this.throttle=setTimeout(d(function(){var i,t;n?(t=(n.find("ul.g-fonts-list")||n).inviewport(" > li:not(.g-font-hide)",550*(0<(t=window.navigator.userAgent).indexOf("MSIE ")||0 .preview').style({fontFamily:t,fontWeight:e}),this.loadedFonts.push(t)},this)}))):clearTimeout(this.throttle)},this),100)},unselect:function(t){if(!(t=t||this.selected))return!1;var e=t.element.data("variant");t.element.removeClass("selected"),t.element.search("input[type=checkbox]").checked(!1),t.element.search("[data-font]").addClass("g-variant-hide"),t.element.find('[data-variant="'+e+'"]').removeClass("g-variant-hide"),t.variants=[t.baseVariant],t.selected=[]},selectFromValue:function(){var t=!1;if((o=this.field.value()).match("family="))var e=o.split("&"),n=e[0].split(":"),i=n[0].replace("family=","").replace(/\+/g," "),r=n[1]?n[1].split(","):["regular"],n=e[1]?e[1].replace("subset=","").split(","):["latin"];else{var e=(e=s('[data-category="local-fonts"][data-font]')||[]).map(function(t){return s(t).data("font")}),o=o.replace(/(\s{1,})?,(\s{1,})?/gi,",").split(","),o=m(e,o);if(!o.length)return!1;t=!0,i=o.shift()}var a=s('ul.g-fonts-list > [data-font="'+i+'"]'+(t?'[data-category="local-fonts"]':':not([data-category="local-fonts"])'));r=r||a.data("variants").split(",")||["regular"],h(r,"400")&&(p(r,"400"),f(r,"regular")),h(r,"400italic")&&(p(r,"400italic"),f(r,"italic")),this.selected={font:i,baseVariant:a.data("variant"),element:a,variants:r,selected:[],local:t,charsets:n,availableVariants:a.data("variants").split(","),expanded:t,loaded:t},(t?[i]:r).forEach(function(t){this.select(a,t),(t=a.find('> ul > [data-variant="'+t+'"]'))&&t.removeClass("g-variant-hide")},this);i=a.find(".font-charsets-selected");i&&(r=a.data("subsets").split(",").length,i.html('( '+n.length+" of "+r+" selected)")),t||(s("ul.g-fonts-list")[0].scrollTop=a[0].offsetTop),this.toggleExpansion(),setTimeout(d(function(){this.toggleExpansion()},this),50),t||setTimeout(d(function(){s("ul.g-fonts-list")[0].scrollTop=a[0].offsetTop},this,250))},select:function(t,e){var n,i,r=t.data("variant"),o=!r;this.selected&&this.selected.element==t||(e&&this.selected&&((n=this.selected.element.find(".font-charsets-selected"))&&(i=t.data("subsets").split(",").length,n.html('( 1 of '+i+" selected)"))),this.selected={font:t.data("font"),baseVariant:r,element:t,variants:[r],selected:[],local:o,charsets:["latin"],availableVariants:t.data("variants").split(","),expanded:o,loaded:o}),e||this.toggleExpansion(),(e||o)&&((t=s('ul.g-fonts-list > [data-font]:not([data-font="'+this.selected.font+'"]) input[type="checkbox"]:checked'))&&(t.checked(!1),t.parent("[data-variants]").removeClass("font-selected")),o=(t=this.selected.element.find('input[type="checkbox"][value="'+(o?this.selected.font:e)+'"]')).checked(),t&&t.checked(!o),o?(e!=this.selected.baseVariant&&p(this.selected.variants,e),p(this.selected.selected,e)):(f(this.selected.variants,e),f(this.selected.selected,e)),this.updateSelection())},toggleExpansion:function(){var t;this.selected.availableVariants.length<=1||(this.selected.local?this.selected.expanded=!0:(this.selected.expanded?(t=':not([data-variant="'+this.selected.variants.join('"]):not([data-variant="')+'"])',(t=this.selected.element.search("[data-font]"+t))&&t.addClass("g-variant-hide")):1<(t=this.selected.element.data("variants")).split(",").length&&(this.manipulateLink(this.selected.font),this.selected.element.search("[data-font]").removeClass("g-variant-hide"),this.selected.loaded||this.wf.load({classes:!1,google:{families:[this.selected.font.replace(/\s/g,"+")+":"+t]},fontactive:d(function(t,e){t=this.fvdToStyle(t,e),e=t.fontWeight;"400"==e?e="normal"==t.fontStyle?"regular":"italic":"italic"==t.fontStyle&&(e+="italic"),this.selected.element.find('li[data-variant="'+e+'"] .preview').style(t),this.selected.loaded=!0},this)})),this.selected.expanded=!this.selected.expanded))},manipulateLink:function(t){t=t.replace(/\s/g,"+");var e,n=s('head link[href*="'+t+'"]');n&&(!(e=decodeURIComponent(n.href()).split("|"))||e.length<=1||(p(e,t),n.attribute("href",encodeURI(e.join("|")))))},toggle:function(t,e){e=s(e);t=s(t.target);return"checkbox"==t.attribute("type")&&t.checked(!t.checked()),this.select(e.parent("[data-font]")||e,!!e.parent("[data-font]")&&e.data("variant"),e),!1},updateSelection:function(){var t,e=s(".g-particles-footer .font-selected");if(e){if(!this.selected.selected.length)return e.empty(),void this.selected.element.removeClass("font-selected");t=this.selected.selected.sort(),t=this.selected.local?"(local)":"("+t.join(", ").replace("regular","normal")+")",this.selected.element.addClass("font-selected"),e.html(""+this.selected.font+" "+t)}},updateTotal:function(){var t=s(".g-particles-header .particle-search-total"),e=s(".g-fonts-list > [data-font]:not(.g-font-hide)");t.text(e?e.length:0)},updateCategories:function(t){t=t.find("[data-font-categories]");t&&(this.filters.categories=t.data("font-categories").split(","))},attachEvents:function(t){var e=t.find(".g-particles-header"),n=t.find(".g-fonts-list"),i=e.find("input.font-search"),e=e.find("input.font-preview");c(n,"scroll",d(this.scroll,this,n)),t.delegate("click",".g-fonts-list li[data-font]",d(this.toggle,this)),i&&i.on("keyup",d(this.search,this,i)),e&&e.on("keyup",d(this.updatePreview,this,e)),this.attachCharsets(t),this.attachLocalVariants(t),this.attachFooter(t)},attachCharsets:function(t){t.delegate("mouseover",".font-charsets-selected",d(function(t,o){o.PopoverDefined||(o.getPopover({placement:"auto",width:"200",trigger:"mouse",style:"font-categories, above-modal"}),o.on("beforeshow.popover",d(function(t){var n,e,i=o.parent("[data-subsets]").data("subsets").split(","),r=t.$target.find(".g5-popover-content");r.empty(),i.forEach(function(t){e=h(this.selected.charsets,t)?"latin"==t?"checked disabled":"checked":"",a("div").html('").bottom(r)},this),r.delegate("click",'input[type="checkbox"]',d(function(t,e){e=s(e),n=r.search('input[type="checkbox"]:checked'),this.selected.charsets=n?n.map("value"):[],o.html('( '+this.selected.charsets.length+" of "+i.length+" selected)")},this)),t.displayContent()},this)),o.getPopover().show())},this))},attachLocalVariants:function(t){t.delegate("mouseover",".g-font-variants-list",d(function(t,i){i.PopoverDefined||(i.getPopover({placement:"auto",width:"200",trigger:"mouse",style:"font-categories, above-modal"}),i.on("beforeshow.popover",d(function(t){var e=t.$target.find(".g5-popover-content"),n=i.parent("[data-variants]").data("variants").split(",");e.empty(),S(n,d(function(t){t="400"==t?"regular":"400italic"==t?"italic":t+"",a("div").text(this.mapVariant(t)).bottom(e)},this)),t.displayContent()},this)))},this))},attachFooter:function(t){var r,e=t.find(".g-particles-footer"),n=e.find("button.button-primary"),o=e.find(".font-category"),i=e.find(".font-subsets");return n.on("click",d(function(){if(!s('ul.g-fonts-list > [data-font] input[type="checkbox"]:checked'))return this.field.value(""),void k.close();var t=this.selected.font.replace(/\s/g,"+"),e=this.selected.selected,n=this.selected.charsets;e&&1==e.length&&"regular"==e[0]&&(e=[]),n&&1==n.length&&"latin"==n[0]&&(n=[]),h(e,"regular")&&(p(e,"regular"),f(e,"400")),h(e,"italic")&&(p(e,"italic"),f(e,"400italic")),this.selected.local?this.field.value(t):this.field.value("family="+t+(e.length?":"+e.join(","):"")+(n.length?"&subset="+n.join(","):"")),this.field.emit("input"),s("body").emit("input",{target:this.field}),k.close()},this)),o.popover({placement:"top",width:"200",trigger:"mouse",style:"font-categories, above-modal"}).on("beforeshow.popover",d(function(t){var n,e=o.data("font-categories").split(","),i=t.$target.find(".g5-popover-content");i.empty(),e.forEach(function(t){"local-fonts"!=t&&(r=h(this.filters.categories,t)?"checked":"",a("div").html('").bottom(i))},this),i.delegate("click",'input[type="checkbox"]',d(function(t,e){e=s(e),n=i.search('input[type="checkbox"]:checked'),this.filters.categories=n?n.map("value"):[],o.find("small").text(this.filters.categories.length),this.search()},this)),t.displayContent()},this)),i.popover({placement:"top",width:"200",trigger:"mouse",style:"font-subsets, above-modal"}).on("beforeshow.popover",d(function(t){var e=i.data("font-subsets").split(","),n=t.$target.find(".g5-popover-content");n.empty(),e.forEach(function(t){r=t==this.filters.script?"checked":"",a("div").html('").bottom(n)},this),n.delegate("change",'input[type="radio"]',d(function(t,e){e=s(e),this.filters.script=e.value(),s(".g-particles-header input.font-preview").value(this.previewSentence[this.filters.script]),i.find("small").text(v(g(e.value().replace("ext","extended")))),this.search(),this.updatePreview()},this)),t.displayContent()},this)),t},search:function(t){t=t||s(".g-particles-header input.font-search");var e,n,i,r=s(".g-fonts-list"),o=t.value();r.search("> [data-font]").forEach(function(t){t=s(t),e=t.data("font"),n=t.data("subsets").split(","),i=t.data("category"),t.removeClass("g-font-hide"),this.selected&&this.selected.font==e&&this.selected.selected.length||(h(n,this.filters.script)&&h(this.filters.categories,i)&&e.match(new RegExp("^"+o+"|\\s"+o,"gi"))?t.removeClass("g-font-hide"):t.addClass("g-font-hide"))},this),this.updateTotal(),clearTimeout(t.refreshTimer),t.refreshTimer=setTimeout(d(function(){this.scroll(s("ul.g-fonts-list"))},this),400),t.previousValue=o},updatePreview:function(t){t=t||s(".g-particles-header input.font-preview"),clearTimeout(t.refreshTimer);var e=t.value(),n=s(".g-fonts-list"),e=b(e)?b(e):this.previewSentence[this.filters.script];if(t.previousValue==e)return!0;n.search("[data-font] .preview").text(e),t.previousValue=e},fvdToStyle:function(t,e){e=e.match(/([a-z])([0-9])/);if(!e)return"";return{fontFamily:t,fontStyle:{n:"normal",i:"italic",o:"oblique"}[e[1]],fontWeight:(100*e[2]).toString()}},mapVariant:function(t){switch(t){case"100":return"Thin 100";case"100italic":return"Thin 100 Italic";case"200":return"Extra-Light 200";case"200italic":return"Extra-Light 200 Italic";case"300":return"Light 300";case"300italic":return"Light 300 Italic";case"400":case"regular":return"Normal 400";case"400italic":case"italic":return"Normal 400 Italic";case"500":return"Medium 500";case"500italic":return"Medium 500 Italic";case"600":return"Semi-Bold 600";case"600italic":return"Semi-Bold 600 Italic";case"700":return"Bold 700";case"700italic":return"Bold 700 Italic";case"800":return"Extra-Bold 800";case"800italic":return"Extra-Bold 800 Italic";case"900":return"Ultra-Bold 900";case"900italic":return"Ultra-Bold 900 Italic";default:return"Unknown Variant"}}});u(function(){s("body").delegate("click","[data-g5-fontpicker]",function(t,e){t&&t.preventDefault&&t.preventDefault();var n=r.get(e);n||(n=new E,r.set(e,n)),n.open(t,e)})}),e.exports=E},{"../../ui":54,"../../utils/async-foreach":63,"../../utils/decouple":65,"../../utils/elements.utils":66,"../../utils/elements.viewport":67,"../../utils/get-ajax-suffix":70,"../../utils/get-ajax-url":71,"../../utils/translate":78,agent:80,"elements/domready":111,"elements/zen":137,"mout/array/append":164,"mout/array/combine":165,"mout/array/contains":166,"mout/array/find":171,"mout/array/forEach":174,"mout/array/insert":176,"mout/array/intersection":177,"mout/array/last":179,"mout/array/map":180,"mout/array/removeAll":182,"mout/array/split":185,"mout/function/bind":192,"mout/object/merge":237,"mout/string/properCase":264,"mout/string/trim":272,"mout/string/unhyphenate":275,prime:301,"prime-util/prime/bound":297,"prime-util/prime/options":298,"prime/emitter":300,"prime/map":302,webfontloader:317}],42:[function(t,e,n){"use strict";var c=t("../../utils/elements.utils"),i=t("elements/domready"),d=t("../../ui").modal,r=t("../../utils/get-ajax-suffix"),o=t("../../utils/get-ajax-url").parse,a=t("../../utils/get-ajax-url").global,s=t("../../utils/translate"),h=t("mout/string/trim"),p=t("mout/array/contains");i(function(){var t=c("body");t.delegate("keyup",'.g-icons input[type="text"]',function(t,e){var n=(e=c(e)).sibling("[data-g5-iconpicker]")||e.siblings().find("[data-g5-iconpicker]"),e=e.value();n.find("i").attribute("class",e||"far fa-hand-point-up picker"),n[0].offsetWidth||n.find("i").attribute("class","far fa-hand-point-up picker")}),t.delegate("click","[data-g5-iconpicker]",function(t,e){t&&t.preventDefault&&t.preventDefault(),e=c(e);var n=c(e.data("g5-iconpicker")),l=e,u=h(n.value()).replace(/\s{2,}/g," ").split(" ");d.open({content:s("GANTRY5_PLATFORM_JS_LOADING"),className:"g5-dialog-theme-default g5-modal-icons",remote:o(a("icons")+r()),afterClose:function(){var t=c(".g5-popover");t&&t.remove()},remoteLoaded:function(t,e){var r,o,a=e.elements.content,e=a.search("[data-g-icon]");if(!e||!t.body.success)return a.html(t.body.html||t.body),!1;function s(){var e=[],t=a.find("[data-g-icon].active"),n=a.search(".g-particles-header .float-right input:checked, .g-particles-header .float-right select");t&&e.push(t.data("g-icon")),n&&n.forEach(function(t){t=c(t).value();t&&"fa-"!==t&&e.push(t)}),a.find(".g-icon-preview").html(' '+e[0]+""),a.find("[data-g-select]").disabled(!a.find("[data-g-icon].active")||null)}function i(){var t=a.search("[data-g-icon]:not(.hide-icon)");a.find(".particle-search-total").text(t?t.length:0)}a.find("[data-g-select]").disabled(!a.find("[data-g-icon].active")||null),a.delegate("click","[data-g-icon]",function(t,e){t&&t.preventDefault&&t.preventDefault(),e=c(e);t=a.find("[data-g-icon].active");t&&t.removeClass("active"),e.addClass("active"),a.find("[data-g-select]").disabled(null),s()}),a.delegate("click","[data-g-select]",function(t){if(t.preventDefault(),!a.find("[data-g-icon].active"))return!1;t=a.find(".g-icon-preview i");n.value(t.attribute("class")),l.find("i").attribute("class",t.attribute("class")),n.emit("input"),c("body").emit("input",{target:n}),d.close()}),a.delegate("change",'.g-particles-header .float-right input[type="checkbox"], .g-particles-header .float-right select',function(){s()}),a.delegate("keyup",'.particle-search-wrapper input[type="text"]',function(t,e){var n=(e=c(e)).value(),e=a.search("[data-g-icon].hide-icon");if(!n)return e&&(e.removeClass("hide-icon"),i()),!0;n=a.search('[data-g-icon*="'+n+'"]');a.search("[data-g-icon]").addClass("hide-icon"),n&&n.removeClass("hide-icon"),i()}),e.forEach(function(t){t=c(t),r="";for(var e,n,i=5;0