=g.maxInteractions)return!1;if(p.target===t){if((a+=f===n.name|0)>=o)return!1;if(p.element===e&&(u++,f!==n.name||u>=r))return!1}}}return g.maxInteractions>0}}var a=t("../interact"),u=t("../Interactable"),c=t("../Interaction"),l=t("../actions/base"),p=t("../defaultOptions"),d=t("../scope"),f=t("../utils"),h=t("../utils/Signals")["new"]();t("./InteractableMethods");var g={signals:h,withinInteractionLimit:s,maxInteractions:Infinity,defaults:{perAction:{manualStart:!1,max:Infinity,maxPerElement:1,allowFrom:null,ignoreFrom:null,mouseButtons:1}},setActionDefaults:function(t){f.extend(t.defaults,g.defaults.perAction)},validateAction:n};c.signals.on("down",function(t){var e=t.interaction,n=t.pointer,i=t.event,s=t.eventTarget;if(!e.interacting()){r(e,o(e,n,i,s))}}),c.signals.on("move",function(t){var e=t.interaction,n=t.pointer,i=t.event,s=t.eventTarget;if("mouse"===e.pointerType&&!e.pointerIsDown&&!e.interacting()){r(e,o(e,n,i,s))}}),c.signals.on("move",function(t){var e=t.interaction,n=t.event;if(e.pointerIsDown&&!e.interacting()&&e.pointerWasMoved&&e.prepared.name){h.fire("before-start",t);var i=e.target;e.prepared.name&&i&&(i.options[e.prepared.name].manualStart||!s(i,e.element,e.prepared)?e.stop(n):e.start(e.prepared,i,e.element))}}),c.signals.on("stop",function(t){var e=t.interaction,n=e.target;n&&n.options.styleCursor&&(n._doc.documentElement.style.cursor="")}),a.maxInteractions=function(t){return f.is.number(t)?(g.maxInteractions=t,a):g.maxInteractions},u.settingsMethods.push("styleCursor"),u.settingsMethods.push("actionChecker"),u.settingsMethods.push("ignoreFrom"),u.settingsMethods.push("allowFrom"),p.base.actionChecker=null,p.base.styleCursor=!0,f.extend(p.perAction,g.defaults.perAction),e.exports=g},{"../Interactable":4,"../Interaction":5,"../actions/base":6,"../defaultOptions":18,"../interact":21,"../scope":33,"../utils":43,"../utils/Signals":34,"./InteractableMethods":12}],14:[function(t){"use strict";function e(t,e){if(!e)return!1;var n=e.options.drag.startAxis;return"xy"===t||"xy"===n||n===t}var n=t("./base"),i=t("../scope"),o=t("../utils/is"),r=t("../utils/domUtils"),s=r.parentNode;n.setActionDefaults(t("../actions/drag")),n.signals.on("before-start",function(t){var r=t.interaction,a=t.eventTarget,u=t.dx,c=t.dy;if("drag"===r.prepared.name){var l=Math.abs(u),p=Math.abs(c),d=r.target.options.drag,f=d.startAxis,h=l>p?"x":l0&&(e.autoStartHoldTimer=setTimeout(function(){e.start(e.prepared,e.target,e.element)},i))}),o.signals.on("move",function(t){var e=t.interaction,n=t.duplicate;e.pointerWasMoved&&!n&&clearTimeout(e.autoStartHoldTimer)}),i.signals.on("before-start",function(t){var e=t.interaction;n(e)>0&&(e.prepared.name=null)}),e.exports={getHoldDuration:n}},{"../Interaction":5,"./base":13}],17:[function(t){"use strict";t("./base").setActionDefaults(t("../actions/resize"))},{"../actions/resize":10,"./base":13}],18:[function(t,e){"use strict";e.exports={base:{accept:null,preventDefault:"auto",deltaSource:"page"},perAction:{origin:{x:0,y:0},inertia:{enabled:!1,resistance:10,minSpeed:100,endSpeed:10,allowResume:!0,smoothEndDuration:300}}}},{}],19:[function(t,e){"use strict";t("./inertia"),t("./modifiers/snap"),t("./modifiers/restrict"),t("./pointerEvents/base"),t("./pointerEvents/holdRepeat"),t("./pointerEvents/interactableTargets"),t("./autoStart/hold"),t("./actions/gesture"),t("./actions/resize"),t("./actions/drag"),t("./actions/drop"),t("./modifiers/snapSize"),t("./modifiers/restrictEdges"),t("./modifiers/restrictSize"),t("./autoStart/gesture"),t("./autoStart/resize"),t("./autoStart/drag"),t("./interactablePreventDefault.js"),t("./autoScroll"),e.exports=t("./interact")},{"./actions/drag":7,"./actions/drop":8,"./actions/gesture":9,"./actions/resize":10,"./autoScroll":11,"./autoStart/drag":14,"./autoStart/gesture":15,"./autoStart/hold":16,"./autoStart/resize":17,"./inertia":20,"./interact":21,"./interactablePreventDefault.js":22,"./modifiers/restrict":24,"./modifiers/restrictEdges":25,"./modifiers/restrictSize":26,"./modifiers/snap":27,"./modifiers/snapSize":28,"./pointerEvents/base":30,"./pointerEvents/holdRepeat":31,"./pointerEvents/interactableTargets":32}],20:[function(t){"use strict";function e(t,e){var n=t.target.options[t.prepared.name].inertia,i=n.resistance,o=-Math.log(n.endSpeed/e.v0)/i;e.x0=t.prevEvent.pageX,e.y0=t.prevEvent.pageY,e.t0=e.startEvent.timeStamp/1e3,e.sx=e.sy=0,e.modifiedXe=e.xe=(e.vx0-o)/i,e.modifiedYe=e.ye=(e.vy0-o)/i,e.te=o,e.lambda_v0=i/e.v0,e.one_ve_v0=1-n.endSpeed/e.v0}function n(){o(this),u.setCoordDeltas(this.pointerDelta,this.prevCoords,this.curCoords);var t=this.inertiaStatus,e=this.target.options[this.prepared.name].inertia,n=e.resistance,i=(new Date).getTime()/1e3-t.t0;if(ip.minSpeed&&g>p.endSpeed,b={interaction:n,pageCoords:h,statuses:f,preEnd:!0,requireEndOnly:!0};y&&!x&&(a.resetStatuses(f),m=a.setAll(b),m.shouldMove&&m.locked&&(v=!0)),(x||v)&&(u.copyCoords(o.upCoords,n.curCoords),n.pointers[0]=o.startEvent=new r(n,i,n.prepared.name,"inertiastart",n.element),o.t0=d,o.active=!0,o.allowResume=p.allowResume,n.simulation=o,s.fire(o.startEvent),x?(o.vx0=n.pointerDelta.client.vx,o.vy0=n.pointerDelta.client.vy,o.v0=g,e(n,o),u.extend(h,n.curCoords.page),h.x+=o.xe,h.y+=o.ye,a.resetStatuses(f),m=a.setAll(b),o.modifiedXe+=m.dx,o.modifiedYe+=m.dy,o.i=c.request(n.boundInertiaFrame)):(o.smoothEnd=!0,o.xe=m.dx,o.ye=m.dy,o.sx=o.sy=0,o.i=c.request(n.boundSmoothEndFrame)))}}),s.signals.on("stop-active",function(t){var e=t.interaction,n=e.inertiaStatus;n.active&&(c.cancel(n.i),n.active=!1,e.simulation=null)})},{"./InteractEvent":3,"./Interaction":5,"./modifiers/base":23,"./utils":43,"./utils/raf":49}],21:[function(t,e){"use strict";function n(t,e){var n=s.interactables.get(t,e);return n||(n=new a(t,e),n.events.global=c),n}var i=t("./utils/browser"),o=t("./utils/events"),r=t("./utils"),s=t("./scope"),a=t("./Interactable"),u=t("./Interaction"),c={};n.isSet=function(t,e){return-1!==s.interactables.indexOfElement(t,e&&e.context)},n.on=function(t,e,i){if(r.is.string(t)&&-1!==t.search(" ")&&(t=t.trim().split(/ +/)),r.is.array(t)){for(var u=0;u=0;e--)s.interactions[e].stop(t);return n},n.pointerMoveTolerance=function(t){return r.is.number(t)?(u.pointerMoveTolerance=t,n):u.pointerMoveTolerance},n.addDocument=s.addDocument,n.removeDocument=s.removeDocument,s.interact=n,e.exports=n},{"./Interactable":4,"./Interaction":5,"./scope":33,"./utils":43,"./utils/browser":36,"./utils/events":39}],22:[function(t){"use strict";function e(t){var e=t.interaction,n=t.event;e.target&&e.target.checkAndPreventDefault(n)}var n=t("./Interactable"),i=t("./Interaction"),o=t("./scope"),r=t("./utils/is"),s=t("./utils/events"),a=t("./utils/domUtils"),u=a.nodeContains,c=a.matchesSelector;n.prototype.preventDefault=function(t){return/^(always|never|auto)$/.test(t)?(this.options.preventDefault=t,this):r.bool(t)?(this.options.preventDefault=t?"always":"never",this):this.options.preventDefault},n.prototype.checkAndPreventDefault=function(t){var e=this.options.preventDefault;if("never"!==e)return"always"===e?void t.preventDefault():void(s.supportsOptions&&/^touch(start|move)$/.test(t.type)||/^(mouse|pointer|touch)*(down|start)/i.test(t.type)||r.element(t.target)&&c(t.target,"input,select,textarea,[contenteditable=true],[contenteditable=true] *")||t.preventDefault())};for(var l=["down","move","up","cancel"],p=0;p=0&&(d.selectors[f]!==t||d.contexts[f]!==e);f--);-1===f&&(f=d.selectors.length,d.selectors.push(t),d.contexts.push(e),d.listeners.push([])),d.listeners[f].push([o,!!u.capture,u.passive])}function r(t,e,n,o,r){var u=c(r),l=b[n],p=!1,d=void 0;if(l)for(d=l.selectors.length-1;d>=0;d--)if(l.selectors[d]===t&&l.contexts[d]===e){for(var f=l.listeners[d],h=f.length-1;h>=0;h--){var g=f[h],v=g[0],m=g[1],y=g[2];if(v===o&&m===!!u.capture&&y===u.passive){f.splice(h,1),f.length||(l.selectors.splice(d,1),l.contexts.splice(d,1),l.listeners.splice(d,1),i(e,n,s),i(e,n,a,!0),l.selectors.length||(b[n]=null)),p=!0;break}}if(p)break}}function s(t,e){var n=c(e),i={},o=b[t.type],r=d.getEventTargets(t),s=r[0],a=s;for(f(i,t),i.originalEvent=t,i.preventDefault=u;l.element(a);){for(var h=0;h=2)continue;if(!r.interacting()&&e===r.pointerType)return r}return null}};e.exports=o},{"../scope":33,"./index":43}],45:[function(t,e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=t("./window"),o=t("./isWindow"),r={array:function(){},window:function(t){return t===i.window||o(t)},docFrag:function(t){return r.object(t)&&11===t.nodeType},object:function(t){return!!t&&"object"===(void 0===t?"undefined":n(t))},"function":function(t){return"function"==typeof t},number:function(t){return"number"==typeof t},bool:function(t){return"boolean"==typeof t},string:function(t){return"string"==typeof t},element:function(t){if(!t||"object"!==(void 0===t?"undefined":n(t)))return!1;var e=i.getWindow(t)||i.window;return/object|function/.test(n(e.Element))?t instanceof e.Element:1===t.nodeType&&"string"==typeof t.nodeName}};r.array=function(t){return r.object(t)&&"undefined"!=typeof t.length&&r["function"](t.splice)},e.exports=r},{"./isWindow":46,"./window":51}],46:[function(t,e){"use strict";e.exports=function(t){return!(!t||!t.Window)&&t instanceof t.Window}},{}],47:[function(t,e){"use strict";function n(t,n){for(var i in n){var o=e.exports.prefixedPropREs,r=!1;for(var s in o)if(0===i.indexOf(s)&&o[s].test(i)){r=!0;break}r||"function"==typeof n[i]||(t[i]=n[i])}return t}n.prefixedPropREs={webkit:/(Movement[XY]|Radius[XY]|RotationAngle|Force)$/},e.exports=n},{}],48:[function(t,e){"use strict";var n=t("./hypot"),i=t("./browser"),o=t("./domObjects"),r=t("./domUtils"),s=t("./domObjects"),a=t("./is"),u=t("./pointerExtend"),c={copyCoords:function(t,e){t.page=t.page||{},t.page.x=e.page.x,t.page.y=e.page.y,t.client=t.client||{},t.client.x=e.client.x,t.client.y=e.client.y,t.timeStamp=e.timeStamp},setCoordDeltas:function(t,e,i){t.page.x=i.page.x-e.page.x,t.page.y=i.page.y-e.page.y,t.client.x=i.client.x-e.client.x,t.client.y=i.client.y-e.client.y,t.timeStamp=i.timeStamp-e.timeStamp;var o=Math.max(t.timeStamp/1e3,.001);t.page.speed=n(t.page.x,t.page.y)/o,t.page.vx=t.page.x/o,t.page.vy=t.page.y/o,t.client.speed=n(t.client.x,t.page.y)/o,t.client.vx=t.client.x/o,t.client.vy=t.client.y/o},isNativePointer:function(t){return t instanceof o.Event||t instanceof o.Touch},getXY:function(t,e,n){return n=n||{},t=t||"page",n.x=e[t+"X"],n.y=e[t+"Y"],n},getPageXY:function(t,e){return e=e||{},i.isOperaMobile&&c.isNativePointer(t)?(c.getXY("screen",t,e),e.x+=window.scrollX,e.y+=window.scrollY):c.getXY("page",t,e),e},getClientXY:function(t,e){return e=e||{},i.isOperaMobile&&c.isNativePointer(t)?c.getXY("screen",t,e):c.getXY("client",t,e),e},getPointerId:function(t){return a.number(t.pointerId)?t.pointerId:t.identifier},setCoords:function(t,e,n){var i=e.length>1?c.pointerAverage(e):e[0],o={};c.getPageXY(i,o),t.page.x=o.x,t.page.y=o.y,c.getClientXY(i,o),t.client.x=o.x,t.client.y=o.y,t.timeStamp=a.number(n)?n:(new Date).getTime()},pointerExtend:u,getTouchPair:function(t){var e=[];return a.array(t)?(e[0]=t[0],e[1]=t[1]):"touchend"===t.type?1===t.touches.length?(e[0]=t.touches[0],e[1]=t.changedTouches[0]):0===t.touches.length&&(e[0]=t.changedTouches[0],e[1]=t.changedTouches[1]):(e[0]=t.touches[0],e[1]=t.touches[1]),e},pointerAverage:function(t){for(var e={pageX:0,pageY:0,clientX:0,clientY:0,screenX:0,screenY:0},n=0;n1){var e=c.getTouchPair(t),n=Math.min(e[0].pageX,e[1].pageX),i=Math.min(e[0].pageY,e[1].pageY);return{x:n,y:i,left:n,top:i,width:Math.max(e[0].pageX,e[1].pageX)-n,height:Math.max(e[0].pageY,e[1].pageY)-i}}},touchDistance:function(t,e){var i=e+"X",o=e+"Y",r=c.getTouchPair(t),s=r[0][i]-r[1][i],a=r[0][o]-r[1][o];return n(s,a)},touchAngle:function(t,e,n){var i=n+"X",o=n+"Y",r=c.getTouchPair(t),s=r[1][i]-r[0][i],a=r[1][o]-r[0][o];return 180*Math.atan2(a,s)/Math.PI},getPointerType:function(t){return a.string(t.pointerType)?t.pointerType:a.number(t.pointerType)?[undefined,undefined,"touch","pen","mouse"][t.pointerType]:/touch/.test(t.type)||t instanceof s.Touch?"touch":"mouse"},getEventTargets:function(t){var e=a["function"](t.composedPath)?t.composedPath():t.path;return[r.getActualElement(e?e[0]:t.target),r.getActualElement(t.currentTarget)]}};e.exports=c},{"./browser":36,"./domObjects":37,"./domUtils":38,"./hypot":42,"./is":45,"./pointerExtend":47}],49:[function(t,e){"use strict";for(var n=t("./window"),i=n.window,o=["ms","moz","webkit","o"],r=0,s=void 0,a=void 0,u=0;u0&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.container=t.container,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var t=this,e="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return t.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px";var n=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=n+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,i["default"])(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=(0,i["default"])(this.target),this.copyText()}},{key:"copyText",value:function(){var t=void 0;try{t=document.execCommand(this.action)}catch(e){t=!1}this.handleResult(t)}},{key:"handleResult",value:function(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(t){if(void 0!==t){if(!t||"object"!==(void 0===t?"undefined":o(t))||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function(){return this._target}}]),t}();t.exports=s})},function(t,e,n){function i(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!a.string(e))throw new TypeError("Second argument must be a String");if(!a.fn(n))throw new TypeError("Third argument must be a Function");if(a.node(t))return o(t,e,n);if(a.nodeList(t))return r(t,e,n);if(a.string(t))return s(t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function o(t,e,n){return t.addEventListener(e,n),{destroy:function(){t.removeEventListener(e,n)}}}function r(t,e,n){return Array.prototype.forEach.call(t,function(t){t.addEventListener(e,n)}),{destroy:function(){Array.prototype.forEach.call(t,function(t){t.removeEventListener(e,n)})}}}function s(t,e,n){return u(document.body,t,e,n)}var a=n(6),u=n(5);t.exports=i},function(t){function e(){}e.prototype={on:function(t,e,n){var i=this.e||(this.e={});return(i[t]||(i[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){function i(){o.off(t,i),e.apply(n,arguments)}var o=this;return i._=e,this.on(t,i,n)},emit:function(t){var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),i=0,o=n.length;for(i;i0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===d(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=(0,p["default"])(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new c["default"]({action:this.action(e),target:this.target(e),text:this.text(e),container:this.container,trigger:e,emitter:this})}},{key:"defaultAction",value:function(t){return u("action",t)}},{key:"defaultTarget",value:function(t){var e=u("target",t);if(e)return document.querySelector(e)}},{key:"defaultText",value:function(t){return u("text",t)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],e="string"==typeof t?[t]:t,n=!!document.queryCommandSupported;return e.forEach(function(t){n=n&&!!document.queryCommandSupported(t)}),n}}]),e}(l["default"]);t.exports=h})},function(t){function e(t,e){for(;t&&t.nodeType!==n;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}var n=9;if("undefined"!=typeof Element&&!Element.prototype.matches){var i=Element.prototype;i.matches=i.matchesSelector||i.mozMatchesSelector||i.msMatchesSelector||i.oMatchesSelector||i.webkitMatchesSelector}t.exports=e},function(t,e,n){function i(t,e,n,i,o){var s=r.apply(this,arguments);return t.addEventListener(n,s,o),{destroy:function(){t.removeEventListener(n,s,o)}}}function o(t,e,n,o,r){return"function"==typeof t.addEventListener?i.apply(null,arguments):"function"==typeof n?i.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,function(t){return i(t,e,n,o,r)}))}function r(t,e,n,i){return function(n){n.delegateTarget=s(n.target,e),n.delegateTarget&&i.call(t,n)}}var s=n(4);t.exports=o},function(t,e){e.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},e.nodeList=function(t){var n=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===n||"[object HTMLCollection]"===n)&&"length"in t&&(0===t.length||e.node(t[0]))},e.string=function(t){return"string"==typeof t||t instanceof String},e.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},function(t){function e(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var i=window.getSelection(),o=document.createRange();o.selectNodeContents(t),i.removeAllRanges(),i.addRange(o),e=i.toString()}return e}t.exports=e}])}),function(t){function e(t,e){return e=e||0,Math.round(t*Math.pow(10,e))/Math.pow(10,e)}function n(t,e){for(var n={},i=[],o=0,r=t.length;o-s&&(c-=s,t+=a),ln;u-=r){var c=s(t,u),l=b.getAvg(o,c),p=a(t,n,i);if(!l.equals(p))return!1}return!0}function h(t,e,n){e=e||0,n=n||t.length-1;var i=[];return f(t,e,n)?(i.push(e),n!==t.length-1?i=i.concat(h(t,n,t.length-1)):n!==t.length-1||1===i.length&&s(t,0).equals(s(t,n))||i.push(n)):i=i.concat(h(t,e,n-1)),i}function g(t){try{var n=l(t),i=p(t,n);return new r(h(i).map(function(t){return{idx:e(t/(i.length-1),2),color:s(i,t)}}),n,t)}catch(t){return!1}}function v(t){for(var e=t.getImageData(0,0,t.canvas.width,t.canvas.height),n=e.width,i=e.height,o=e.data,r=[],s=0;se)return!1;if(Math.abs(this.g-t.g)>e)return!1;if(Math.abs(this.b-t.b)>e)return!1;var n="undefined"==typeof this.a?255:this.a,i="undefined"==typeof t.a?255:t.a;return!(Math.abs(n-i)>e)},b.prototype.toString=function(){return 255===this.a?"rgb("+e(this.r)+", "+e(this.g)+", "+e(this.b)+")":"rgba("+e(this.r)+", "+e(this.g)+", "+e(this.b)+", "+e(this.a/255,2)+")"},r.prototype.toCanvas=function(){var t=document.createElement("canvas");t.width=this.colorarray[0].length,t.height=this.colorarray.length;var e=t.getContext("2d"),n=e.createImageData(t.width,t.height);return o(i(this.colorarray),n.data),e.clearRect(0,0,t.width,t.height),e.putImageData(n,0,0),t},r.prototype.toCss=function(){if(1===this.stops.length)return"background-color: "+this.stops[0].color.toString();var t=n(this.stops,function(t){return e(100*t.idx)});t=t.map(function(t){return t.color.toString()+" "+e(100*t.idx)+"%"});var i=this.angle+"deg, "+t.join(","),o=Math.abs(this.angle-450)%360;t.join(",");return"background: -webkit-linear-gradient("+i+");\nbackground: -o-linear-gradient("+i+");\nbackground: -ms-linear-gradient("+i+");\nbackground: -moz-linear-gradient("+i+");\nbackground: linear-gradient("+i+");\n"},t.GradientFinder={fromUrl:y,fromCanvas:m,colorsEqual:x,Gradient:r,Color:b}}(window),GradientCanvas.fromExportable=function(t){return new GradientCanvas(t.colors.map(function(t){return{offset:t[0],color:tinycolor(t[1]).toRgbString()}}),t.alphas.map(function(t){return{offset:t[0],alpha:t[1]}}),t.angle)},GradientCanvas.prototype.toExportable=function(){return{colors:this.getColorStops().map(function(t){return[t.getOffset(),tinycolor(t.color).toHex()]}),alphas:this.getAlphaStops().map(function(t){return[t.getOffset(),t.alpha]}),angle:this.angle}},GradientCanvas.prototype.stopsToCSS=function(t,e){if(0===e.length)return"transparent";if(1===e.length)return[e[0].color];var n=e.map(function(t){return t.color+" "+Math.max(0,Math.min(parseInt(100*t.offset)))+"%"});return"linear-gradient("+this.angleToCSSValue(t)+", "+n.join(", ")+")"},GradientCanvas.prototype.stopsToW3cCSS=function(t,e){if(0===e.length)return"transparent";if(1===e.length)return[e[0].color];var n=e.map(function(t){return t.color+" "+Math.max(0,Math.min(parseInt(100*t.offset)))+"%"});return"linear-gradient("+this.angleToW3cCSSValue(t)+", "+n.join(", ")+")"},GradientCanvas.prototype.angleToW3cCSSValue=function(t){var e=t||this.angle;void 0===e&&(e="top"),0>e&&(e+=360);var n={0:"to right",90:"to top",180:"to left",270:"to bottom"},i=Math.abs(e-450)%360;return n[e]&&(e=n[e]),isNaN(parseInt(e))||(e=i+"deg"),e},GradientCanvas.prototype.angleToCSSValue=function(t){var e=t||this.angle;void 0===e&&(e="top"),0>e&&(e+=360);var n={0:"left",90:"bottom",180:"right",270:"top"};return n[e]&&(e=n[e]),isNaN(parseInt(e))||(e+="deg"),e},GradientCanvas.prototype.angleToGradientVector=function(){function t(t){return{x:Math.cos(t),y:Math.sin(t)}}function e(t){return t*Math.PI/180}var n=this.getAngle(),i=Math.pow(2,-52),o=n%360,r=t(e(180-o)),s=t(e(360-o));return 0>=r.x||i>=Math.abs(r.x)?r.x=0:(o>90&&180>o||o>270&&360>o)&&(r.x=parseFloat(r.x+.3)),0>=r.y||i>=Math.abs(r.y)?r.y=0:(o>90&&180>o||o>270&&360>o)&&(r.y=parseFloat(r.y+.3)),0>=s.x||i>=Math.abs(s.x)?s.x=0:(o>90&&180>o||o>270&&360>o)&&(s.x=parseFloat(s.x+.3)),0>=s.y||i>=Math.abs(s.y)?s.y=0:(o>90&&180>o||o>270&&360>o)&&(s.y=parseFloat(s.y+.3)),{x1:parseInt(100*r.x),y1:parseInt(100*r.y),x2:parseInt(100*s.x),y2:parseInt(100*s.y)}},GradientCanvas.prototype.toCSSAlpha=function(t){var e=this.getAlphaStopsBlack();return 0===e.length&&(e=[{color:"#000",offset:1}]),this.stopsToCSS(t,e)},GradientCanvas.prototype.toSVG=function(){var t=this.getAllStops(),e=t.map(function(t){return''}),n=this.angleToGradientVector();return['',e.join("\n "),""].join("\n")},GradientCanvas.prototype.getAngle=function(){for(;0>this.angle;)this.angle+=360;return this.angle%360},GradientCanvas.prototype.toCSSColor=function(t){return this.stopsToCSS(t,this.getColorStops())},GradientCanvas.prototype.toCSS=function(t){return this.stopsToCSS(t,this.getAllStops())},GradientCanvas.prototype.toW3cCSS=function(t){return this.stopsToW3cCSS(t,this.getAllStops())},GradientCanvas.prototype.removeStop=function(t){this.removeColorStop(t),this.removeAlphaStop(t)},GradientCanvas.prototype.removeColorStop=function(t){var e=this._colorStops.indexOf(t);-1!=e&&this._colorStops.splice(e,1)},GradientCanvas.prototype.removeAlphaStop=function(t){var e=this._alphaStops.indexOf(t);-1!=e&&this._alphaStops.splice(e,1)},GradientCanvas.prototype.getAllStops=function(){var t=this,e=this.getColorStops().map(function(e){var n=t.getInterpolatedAlphaAtOffset(e.offset),i=tinycolor(e.color);return i.setAlpha(n),{color:i.toString("rgb"),hex:i.toString("hex"),offset:e.offset,percent:e.getPercentOffset(),alpha:n}}),n=this.getAlphaStops().map(function(e){var n=tinycolor(t.getInterpolatedColorAtOffset(e.offset));return n.setAlpha(e.alpha),{color:n.toString("rgb"),hex:n.toString("hex"),offset:e.offset,percent:e.getPercentOffset(),alpha:e.alpha}});return 2>n.length&&(n=[]),e.concat(n).unique(function(t){return t.offset}).sort(function(t,e){return t.offset-e.offset})},GradientCanvas.prototype.getColorStops=function(){return this._colorStops.sort(function(t,e){return t.offset-e.offset})},GradientCanvas.prototype.getAlphaStops=function(){return this._alphaStops.sort(function(t,e){return t.offset-e.offset})},GradientCanvas.prototype.getAlphaStopsBlack=function(){return this.getAlphaStops().map(function(t){return{color:"rgba(0, 0, 0, "+t.alpha+")",offset:Math.max(0,Math.min(1,t.offset))}})},GradientCanvas.prototype.toCanvas=function(t,e,n,i){t=t||100,e=e||100;var o=document.createElement("canvas"),r=o.getContext("2d");o.width=t,o.height=e;var s={x1:0,x2:100,y1:0,y2:0};i||(s=this.angleToGradientVector(this.angle)),s.x1=s.x1/100*t,s.x2=s.x2/100*t,s.y1=s.y1/100*e,s.y2=s.y2/100*e;for(var a=r.createLinearGradient(s.x1,s.y1,s.x2,s.y2),u=n||this.getAllStops(),c=0;u.length>c;c++)a.addColorStop(Math.max(0,Math.min(1,u[c].offset)),u[c].color);return r.fillStyle=a,r.fillRect(0,0,t,e),o},GradientCanvas.prototype.toCanvasRules=function(t,e){var n=this.angleToGradientVector(this.angle);n.x1=n.x1/100*t,n.x2=n.x2/100*t,n.y1=n.y1/100*e,n.y2=n.y2/100*e;var i=this.getAllStops().map(function(t){return"gradient.addColorStop("+Math.max(0,Math.min(1,t.offset))+', "'+t.color+'");'});return["var canvas = document.createElement('canvas');","var context = canvas.getContext('2d')","canvas.width = "+t+";","canvas.height = "+e+";","var gradient = context.createLinearGradient("+n.x1+", "+n.y1+", "+n.x2+", "+n.y2+");",i.join("\n"),"context.fillStyle = gradient;","context.fillRect(0, 0, "+t+", "+e+");"].join("\n")},GradientCanvas.prototype.getInterpolatedColorAtOffset=function(t){var e=this.toCanvas(100,1,this.getColorStops(),!0),n=e.getContext("2d"),i=Math.max(0,Math.min(99,parseInt(100*t))),o=n.getImageData(i,0,1,1).data;return tinycolor({r:o[0],g:o[1],b:o[2]}).toHexString()},GradientCanvas.prototype.getInterpolatedAlphaAtOffset=function(t){var e=this.getAlphaStopsBlack();if(0===e.length)return 1;var n=this.toCanvas(100,1,e,!0),i=n.getContext("2d"),o=Math.max(0,Math.min(99,parseInt(100*t))),r=i.getImageData(o,0,1,1).data;return Math.round(r[3]/255*100)/100},GradientCanvas.prototype.cloneStop=function(t,e){var n=t.offset,i=t.hasOwnProperty("alpha");if(e){var o=Math.random()/5,r=i?this.getAlphaStops():this.getColorStops(),s=r.indexOf(t),a=.5>n?n+o:n-o,u=s>0?r[s-1].offset:0,c=r.length-1>s?r[s+1].offset:1;Math.abs(n-a)n.alpha&&(this.addAlphaStop(t,n.alpha),n.setAlpha(1));var i={offset:t,color:""+n,hex:n.toHexString(),getOffset:function(){return Math.min(1,Math.max(0,Math.round(100*this.offset)/100))},getPercentOffset:function(){return 100*i.getOffset()+"%"},setOffset:function(t){i.offset=Math.min(1,Math.max(0,t))}};return this._colorStops.push(i),this.getColorStops().indexOf(i)},GradientCanvas.prototype.addAlphaStop=function(t,e){e=e||this.getInterpolatedAlphaAtOffset(t);var n={offset:t,alpha:e,getOffset:function(){return Math.min(1,Math.max(0,Math.round(100*this.offset)/100))},getPercentOffset:function(){return 100*n.getOffset()},setOffset:function(t){n.offset=Math.min(1,Math.max(0,t))}};return this._alphaStops.push(n),this.getAlphaStops().indexOf(n)},/*!
* Isotope PACKAGED v3.0.6
*
* Licensed GPLv3 for open source use
* or Isotope Commercial License for commercial use
*
* https://isotope.metafizzy.co
* Copyright 2010-2018 Metafizzy
*/
function(t,e){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(n){return e(t,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function n(n,r,a){function u(t,e,i){var o,r="$()."+n+'("'+e+'")';return t.each(function(t,u){var c=a.data(u,n);if(!c)return void s(n+" not initialized. Cannot call methods, i.e. "+r);var l=c[e];if(!l||"_"==e.charAt(0))return void s(r+" is not a valid method");var p=l.apply(c,i);o=void 0===o?p:o}),void 0!==o?o:t}function c(t,e){t.each(function(t,i){var o=a.data(i,n);o?(o.option(e),o._init()):(o=new r(i,e),a.data(i,n,o))})}(a=a||e||t.jQuery)&&(r.prototype.option||(r.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[n]=function(t){if("string"==typeof t){return u(this,t,o.call(arguments,1))}return c(this,t),this},i(a))}function i(t){!t||t&&t.bridget||(t.bridget=n)}var o=Array.prototype.slice,r=t.console,s=void 0===r?function(){}:function(t){r.error(t)};return i(e||t.jQuery),n}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var n=this._events=this._events||{},i=n[t]=n[t]||[];return-1==i.indexOf(e)&&i.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var n=this._onceEvents=this._onceEvents||{};return(n[t]=n[t]||{})[e]=!0,this}},e.off=function(t,e){var n=this._events&&this._events[t];if(n&&n.length){var i=n.indexOf(e);return-1!=i&&n.splice(i,1),this}},e.emitEvent=function(t,e){var n=this._events&&this._events[t];if(n&&n.length){n=n.slice(0),e=e||[];for(var i=this._onceEvents&&this._onceEvents[t],o=0;o1&&n+t>this.cols?0:n;var i=e.size.outerWidth&&e.size.outerHeight;return this.horizontalColIndex=i?n+t:this.horizontalColIndex,{col:n,y:this._getColGroupY(n,t)}},i._manageStamp=function(t){var n=e(t),i=this._getElementOffset(t),o=this._getOption("originLeft"),r=o?i.left:i.right,s=r+n.outerWidth,a=Math.floor(r/this.columnWidth);a=Math.max(0,a);var u=Math.floor(s/this.columnWidth);u-=s%this.columnWidth?0:1,u=Math.min(this.cols-1,u);for(var c=this._getOption("originTop"),l=(c?i.top:i.bottom)+n.outerHeight,p=a;p<=u;p++)this.colYs[p]=Math.max(l,this.colYs[p])},i._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this._getOption("fitWidth")&&(t.width=this._getContainerFitWidth()),t},i._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&&0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},i.needsResizeLayout=function(){var t=this.containerWidth;return this.getContainerWidth(),t!=this.containerWidth},n}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/layout-modes/masonry",["../layout-mode","masonry-layout/masonry"],e):"object"==typeof module&&module.exports?module.exports=e(require("../layout-mode"),require("masonry-layout")):e(t.Isotope.LayoutMode,t.Masonry)}(window,function(t,e){"use strict";var n=t.create("masonry"),i=n.prototype,o={_getElementOffset:!0,layout:!0,_getMeasurement:!0};for(var r in e.prototype)o[r]||(i[r]=e.prototype[r]);var s=i.measureColumns;i.measureColumns=function(){this.items=this.isotope.filteredItems,s.call(this)};var a=i._getOption;return i._getOption=function(t){return"fitWidth"==t?void 0!==this.options.isFitWidth?this.options.isFitWidth:this.options.fitWidth:a.apply(this.isotope,arguments)},n}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/layout-modes/fit-rows",["../layout-mode"],e):"object"==typeof exports?module.exports=e(require("../layout-mode")):e(t.Isotope.LayoutMode)}(window,function(t){"use strict";var e=t.create("fitRows"),n=e.prototype;return n._resetLayout=function(){this.x=0,this.y=0,this.maxY=0,this._getMeasurement("gutter","outerWidth")},n._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth+this.gutter,n=this.isotope.size.innerWidth+this.gutter;0!==this.x&&e+this.x>n&&(this.x=0,this.y=this.maxY);var i={x:this.x,y:this.y};return this.maxY=Math.max(this.maxY,this.y+t.size.outerHeight),this.x+=e,i},n._getContainerSize=function(){return{height:this.maxY}},e}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/layout-modes/vertical",["../layout-mode"],e):"object"==typeof module&&module.exports?module.exports=e(require("../layout-mode")):e(t.Isotope.LayoutMode)}(window,function(t){"use strict";var e=t.create("vertical",{horizontalAlignment:0}),n=e.prototype;return n._resetLayout=function(){this.y=0},n._getItemLayoutPosition=function(t){t.getSize();var e=(this.isotope.size.innerWidth-t.size.outerWidth)*this.options.horizontalAlignment,n=this.y;return this.y+=t.size.outerHeight,{x:e,y:n}},n._getContainerSize=function(){return{height:this.y}},e}),function(t,e){"function"==typeof define&&define.amd?define(["outlayer/outlayer","get-size/get-size","desandro-matches-selector/matches-selector","fizzy-ui-utils/utils","isotope-layout/js/item","isotope-layout/js/layout-mode","isotope-layout/js/layout-modes/masonry","isotope-layout/js/layout-modes/fit-rows","isotope-layout/js/layout-modes/vertical"],function(n,i,o,r,s,a){return e(t,n,i,o,r,s,a)}):"object"==typeof module&&module.exports?module.exports=e(t,require("outlayer"),require("get-size"),require("desandro-matches-selector"),require("fizzy-ui-utils"),require("isotope-layout/js/item"),require("isotope-layout/js/layout-mode"),require("isotope-layout/js/layout-modes/masonry"),require("isotope-layout/js/layout-modes/fit-rows"),require("isotope-layout/js/layout-modes/vertical")):t.Isotope=e(t,t.Outlayer,t.getSize,t.matchesSelector,t.fizzyUIUtils,t.Isotope.Item,t.Isotope.LayoutMode)}(window,function(t,e,n,i,o,r,s){function a(t,e){return function(n,i){for(var o=0;oa||sa?1:-1)*c}}return 0}}var u=t.jQuery,c=String.prototype.trim?function(t){return t.trim()}:function(t){return t.replace(/^\s+|\s+$/g,"")},l=e.create("isotope",{layoutMode:"masonry",isJQueryFiltering:!0,sortAscending:!0});l.Item=r,l.LayoutMode=s;var p=l.prototype;p._create=function(){this.itemGUID=0,this._sorters={},this._getSorters(),e.prototype._create.call(this),this.modes={},this.filteredItems=this.items,this.sortHistory=["original-order"];for(var t in s.modes)this._initLayoutMode(t)},p.reloadItems=function(){this.itemGUID=0,e.prototype.reloadItems.call(this)},p._itemize=function(){for(var t=e.prototype._itemize.apply(this,arguments),n=0;n120)return void i.point.destroy();e.style.webkitTransform=e.style.transform="translateX("+n+"px)",e.setAttribute("data-x",n);var o=Math.round(n/(i.width-28)*100);o>100&&(o=100),i.point.setPosition(o)},s=function(){i.point.updateStop()};return interact(i.dom).draggable({inertia:{resistance:5,minSpeed:200},restrict:{restriction:"parent",elementRect:{top:0,left:0,bottom:1,right:1}},onstart:o,onmove:r,onend:s}),i},Point=function(t,e,n){var i=Object.create(Point.prototype);i.gradient=t,i.color=e?e[0]:[0,0,0,0],i.position=e?e[1]:0,i.isActive=!1,i.input,i.pointBG,i.stop,i.tile,i.inputHex,i.inputPosition,i.deleteButton;var o=function(){i.dom=document.createElement("div"),i.dom.classList.add("js-draggable"),i.dom.classList.add("app-gradient__point"),p(),c(),f(),h()},r=function(){var t=s();return one.color(t).hex()},s=function(){return"rgb("+i.color[0]+","+i.color[1]+","+i.color[2]+")"},a=function(){i.setActive();i.color[0],i.color[1],i.color[2],i.color[3]},u=function(){i.position=this.value,i.setPosition(i.position);var t=Math.round(.01*i.position*(i.gradient.width-28));i.dom.dataset.x=t,i.dom.style.transform="translateX("+t+"px)"},c=function(){i.inputHex.value=r();var t=s();i.pointBG.style.backgroundColor=t,i.tile.style.backgroundColor=t},l=function(){var t=document.createElement("label");t.classList.add("app-gradient__point-label");var e=document.createElement("div");return e.classList.add("app-gradient__point-label-bg"),i.input=document.createElement("input"),i.input.classList.add("app-gradient__point-input"),i.input.value=i.position,t.appendChild(e),t.appendChild(i.input),t},p=function(){var t=Math.round(.01*i.position*(i.gradient.width-28));i.dom.dataset.x=t,i.dom.style.transform="translateX("+t+"px)",i.dom.setAttribute("touch-action","none");var e=document.createElement("div");e.classList.add("app-gradient__point-background");var n=document.createElement("div");n.classList.add("app-gradient__point-visual"),i.pointBG=document.createElement("div"),i.pointBG.classList.add("app-gradient__point-color"),i.dom.appendChild(e),i.dom.appendChild(n),i.dom.appendChild(i.pointBG),i.dom.appendChild(l()),i.gradient.container.appendChild(i.dom),d()},d=function(){var t=$(".js-stops")[0];i.stop=document.createElement("div"),i.stop.classList.add("app-color__stop"),i.isActive&&i.stop.classList.add("is-active");var e=document.createElement("div");e.classList.add("app-color__stop-color");var o=document.createElement("div");o.classList.add("app-color__stop-color-bg"),i.tile=document.createElement("div"),i.tile.classList.add("app-color__stop-color-tile"),i.tile.style.backgroundColor=s(),o.appendChild(i.tile),e.appendChild(o);var a=document.createElement("div");a.classList.add("app-color__stop-hex"),i.inputHex=document.createElement("input"),i.inputHex.value=r(),a.appendChild(i.inputHex);var u=document.createElement("div");u.classList.add("app-color__stop-position"),i.inputPosition=document.createElement("input"),i.inputPosition.value=i.position,u.appendChild(i.inputPosition);var c=document.createElement("div");c.classList.add("app-color__stop-action"),i.deleteButton=document.createElement("button"),i.deleteButton.classList.add("app-color__stop-action-button"),i.deleteButton.innerHTML="×",c.appendChild(i.deleteButton),i.stop.appendChild(e),i.stop.appendChild(a),i.stop.appendChild(u),i.stop.appendChild(c),n?(t.insertBefore(i.stop,n.stop),n=null):t.appendChild(i.stop),h()},f=function(){Drag(i,i.dom,i.gradient.width);i.dom.on("pointerdown",a),i.input.on("change",u)},h=function(){i.tile.on("click",i.setActive),i.inputHex.on("change",i.setHex),i.inputHex.on("focus",i.setActive),i.inputPosition.on("change",u),i.inputPosition.on("focus",i.setActive),i.deleteButton.on("click",i.destroy)};return i.renderStop=d,i.updateStop=i.gradient.renderStops,i.setActive=function(){i.isActive=!0,i.dom.classList.add("is-active"),i.stop.classList.add("is-active"),i.gradient.setCurrentPoint(i)},i.removeActive=function(){i.isActive=!1,i.dom.classList.remove("is-active"),i.stop.classList.remove("is-active")},i.setHex=function(t){var e=t.target.value;"#"!==e.charAt(0)&&(e="#"+e);var n=one.color(e);if(n)var o=n.hex();else var o="#000000";t.target.value=o;var r=one.color(o).cssa().replace("rgba(","").replace(")","").split(","),s=r.map(function(t){return parseFloat(t)});i.setColor(s),i.gradient.updatePicker()},i.setColor=function(t){i.color=t,c()},i.setPosition=function(t){i.position=t,i.input.value=t,i.inputPosition.value=t,i.gradient.updateGradient(i),i.updateStop()},i.checkDelete=function(){"INPUT"!==document.activeElement.tagName&&i.isActive&&i.destroy()},i.destroy=function(){if(i.gradient.points.length<=2)return void console.warn("You must have at least 2 points");i.dom.parentNode.removeChild(i.dom),i.stop.parentNode.removeChild(i.stop),i.gradient.removePoint(i)},i.clear=function(){i.dom.parentNode.removeChild(i.dom),i.stop.parentNode.removeChild(i.stop)},o(),i},Gradient=function(t,e,n,i){var o=Object.create(Gradient.prototype);o.stops=t,o.type=e,o.angle=n,o.index=i,o.points=[],o.currentPoint,o.colorPicker,o.gradientBackground=$(".js-header")[0],o.gradientToolBackground=$(".js-background")[0],o.gradientCopyButton=$(".js-button-copy")[0],o.stopsDOM=$(".js-stops")[0],o.container=$(".js-drag")[0],o.width=o.container.scrollWidth,o.code=$(".js-code")[0],o.buttonLinear=$(".js-button-linear")[0],o.buttonRadial=$(".js-button-radial")[0],o.swatch=$(".js-swatch")[i];var r=function(){o.colorPicker=ColorPicker(o),o.anglePicker=AnglePicker(o,o.angle),t.forEach(function(t){var e=Point(o,t);o.points.push(e)}),o.points[1].setActive(!0),"linear-gradient"===o.type?u(null,!0):c(null,!0),m()},s=function(t){8!==t.keyCode&&46!=t.keyCode||o.currentPoint.checkDelete()},a=function(t){if(t.target.classList.contains("js-drag")){var e,n,i,r=Math.round(t.offsetX/o.width*100);if(o.points.some(function(t){if(t.position<=r)e=t;else if(t.position>=r)return n=t,!0}),e&&n){var s=(r-e.position)/(n.position-e.position),a=pickHex(e.color,n.color,1-s);a.push(1),i=[a,r]}else{i=[(e||n).color,r]}var u=Point(o,i,n);o.points.push(u),u.setActive(),o.setCurrentPoint(u),p()}},u=function(t,e){o.buttonRadial.classList.remove("is-active"),o.buttonLinear.classList.add("is-active"),o.type="linear-gradient",$(".app-option")[1].style.display="block",e||p()},c=function(t,e){o.buttonLinear.classList.remove("is-active"),o.buttonRadial.classList.add("is-active"),o.type="radial-gradient",$(".app-option")[1].style.display="none",e||p()},l=function(){var t="linear-gradient(90deg, ";return o.points.forEach(function(e,n){var i=e.color[0],r=e.color[1],s=e.color[2],a="rgb("+i+","+r+","+s+") "+e.position+"%";n";return r+='background: ',r+=t+d()+";"},g=function(){var t="",e=o.points[0].color[0],n=o.points[0].color[1],i=o.points[0].color[2];t="linear-gradient"===o.type?o.type+"("+o.angle+"deg, ":o.type+"(circle, ";var r="rgb("+e+","+n+","+i+")",s=one.color(r).hex(),a=o.points.length-1,u=o.points[a].color[0],c=o.points[a].color[1],l=o.points[a].color[2],p="rgb("+u+","+c+","+l+")",f=one.color(p).hex(),h='background: rgb('+e+","+n+","+i+");
";return h+='background: ',h+="-moz-"+t+d()+";
",h+='background: ',h+="-webkit-"+t+d()+";
",h+='background: ',h+=t+d()+";
",h+='filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="'+s+'",endColorstr="'+f+'",GradientType=1);'},v=function(){var t=[],e=[];o.points.forEach(function(t){var n=[t.color,t.position];e.push(n)}),t.push(e),t.push(o.type),t.push(o.angle),STOPS[o.index]=t,localStorage.setItem("STOPS",JSON.stringify(STOPS))},m=function(){o.container.on("click",a),document.on("keyup",s),o.buttonLinear.on("click",u),o.buttonRadial.on("click",c)};return o.renderStops=function(){o.stopsDOM.innerHTML="",o.points.forEach(function(t){t.renderStop()})},o.setCurrentPoint=function(t){var e=o.points.indexOf(t);o.points.map(function(t,n){n!=e&&t.removeActive()}),o.currentPoint=t,o.colorPicker.setColor(t)},o.updatePicker=function(){o.colorPicker.setColor(o.currentPoint)},o.updateColor=function(t){o.currentPoint.setColor(t),o.colorPicker.setAlphaColor(o.currentPoint),p()},o.updateGradient=function(){p()},o.updateAngle=function(t){o.angle=t,p()},o.removePoint=function(t){var e=o.points.indexOf(t);e>-1&&o.points.splice(e,1);var n=o.points[Math.floor(o.points.length/2)];n.setActive(),o.setCurrentPoint(n),p()},o.rerender=function(t,e,n,i){o.stops=t,o.type=e,o.angle=n,o.index=i,o.swatch=$(".js-swatch")[i],o.anglePicker=AnglePicker(o,o.angle),o.points.forEach(function(t){t.clear()}),o.points=[],o.stops.forEach(function(t){var e=Point(o,t);o.points.push(e)}),o.points[1].setActive(!0),"linear-gradient"===o.type?u(null,!0):c(null,!0)},o.rerenderCode=f,r(),o},App=function(){var t=Object.create(App.prototype);t.swatches=$(".js-swatch"),t.upload=$(".js-upload")[0],t.compat=$(".js-compat")[0],t.gradient=null,window.isCompat=JSON.parse(localStorage.getItem("isCompat"))||!1;var e=function(){n(),t.swatches.forEach(function(t,e){t.childNodes[1].style.backgroundImage=i(STOPS[e]),e===CURRENT_STOP&&t.classList.add("is-active")});var e=STOPS[CURRENT_STOP][0],o=STOPS[CURRENT_STOP][1],r=STOPS[CURRENT_STOP][2];t.gradient=Gradient(e,o,r,CURRENT_STOP),window.isCompat?(t.compat.checked=!0,$(".code-editor__column-numbers")[0].innerHTML="1
2
3
4
5
6
7
8
9
"):$(".code-editor__column-numbers")[0].innerHTML="1
2
3
4
5
6
",u()},n=function(){new ClipboardJS(".js-copy").on("success",function(t){var e=$(".js-button-copy")[0];e.style.transition="all 250ms ease-in-out",e.style.transform="translateY(0) scaleX(0.02) scaleY(0.5)",setTimeout(function(){e.style.opacity=0},200),setTimeout(function(){e.style.transition="all 1ms linear",e.style.transform=""},500),setTimeout(function(){e.style.opacity=1,e.style.transition="all 150ms ease-in-out"},600),t.clearSelection()})},i=function(t){var e,n=t[0];return e="linear-gradient"===t[1]?"linear-gradient("+t[2]+"deg, ":"radial-gradient(circle, ",n.forEach(function(t,i){var o=t[0][0],r=t[0][1],s=t[0][2],a=t[0][3],u="rgba("+o+","+r+","+s+","+a+") "+t[1]+"%";i2
3
4
5
6
7
8
9
":$(".code-editor__column-numbers")[0].innerHTML="1
2
3
4
5
6
",localStorage.setItem("isCompat",JSON.stringify(window.isCompat)),t.gradient.rerenderCode()},u=function(){t.swatches.on("click",o),t.upload.on("change",s),t.compat.on("change",a)};return window.STOPS=[[[[[2,0,36,1],0],[[9,9,121,1],35],[[0,212,255,1],100]],"linear-gradient",90],[[[[34,193,195,1],0],[[253,187,45,1],100]],"linear-gradient",0],[[[[63,94,251,1],0],[[252,70,107,1],100]],"radial-gradient",90],[[[[131,58,180,1],0],[[253,29,29,1],50],[[252,176,69,1],100]],"linear-gradient",90],[[[[238,174,202,1],0],[[148,187,233,1],100]],"radial-gradient",90]],STOPS=JSON.parse(localStorage.getItem("STOPS"))||STOPS,localStorage.setItem("STOPS",JSON.stringify(STOPS)),window.CURRENT_STOP=JSON.parse(localStorage.getItem("CURRENT_STOP"))||0,e(),t},Backgrounds=function(){var t=Object.create(Backgrounds.prototype),e=function(){t.links=$(".js-backgrounds-link"),t.shades=$(".js-backgrounds-shade"),t.iframe=$(".js-iframe")[0],o(t.links[1]),r(),s()},n=function(e){e.preventDefault(),t.links.forEach(function(t){t.classList.remove("is-active")}),this.querySelector(".sidenav-backgrounds__background").style.transform="",this.classList.add("is-active"),isMobile?window.open(this.href):(o(this),i(this.href))},i=function(e){t.shades.forEach(function(t){setTimeout(function(){t.style.visibility="visible",t.style.transform="scaleX(1) scaleY(1)"},300*Math.random())}),setTimeout(function(){t.iframe.src="about:blank"},750),setTimeout(function(){t.iframe.src=e},800),setTimeout(function(){t.shades.forEach(function(t){t.style.transform="scaleX(0) scaleY(1)"})},1300),setTimeout(function(){t.shades.forEach(function(t){t.style.transition="all 0ms linear",t.style.transform="scaleX(1) scaleY(0)"})},2200),setTimeout(function(){t.shades.forEach(function(t){t.style.visibility="hidden",t.style.transition=""})},2250)},o=function(e){var n=t.links.indexOf(e);t.links.forEach(function(t,e){var i=t.querySelector(".sidenav-backgrounds__background"),o=Math.abs(n-e),r=(110-4*Math.abs(n-e))/100;i.parentNode.classList.contains("is-active")||setTimeout(function(){i.style.transform="scaleX("+r+")"},50*o)})},r=function(){setTimeout(function(){$("#ad_iframe")[0]?(console.log("ad loaded"),$("#ad_iframe")[0].getAttribute("height")):console.log("ad failed to load")},1500)},s=function(){t.links.on("click",n)};return t.add=function(){},e(),t};if(document.body.className.split(" ").some(function(t){return/shades-of-.*/.test(t)})){console.log("shades");var count=$(".js-filter-count")[0],shades=$(".swatch-cards")[0],filters=$(".js-filter"),iso=null,init=function(){iso=new Isotope(shades,{itemSelector:".swatch-card",layoutMode:"fitRows"}),setFilters(),setClipboard()},setActiveFilter=function(){var t=this.dataset.filter;filters.forEach(function(t){t.classList.remove("is-active")}),this.classList.add("is-active"),iso.arrange({filter:t}),updateFilterCount()},setFilters=function(){filters.on("click",setActiveFilter)},updateFilterCount=function(){count.innerHTML=iso.filteredItems.length},setClipboard=function(){new ClipboardJS(".js-copy").on("success",function(t){var e=t.trigger.parentNode.parentNode,n=e.querySelector(".swatch-card__copy-alert");n.classList.add("is-copied"),setTimeout(function(){n.classList.remove("is-copied")},1200)})};shades&&init()}if(document.body.classList.contains("index"))var app=App();if(document.body.classList.contains("swatches")){var clipboard=new ClipboardJS(".js-copy");clipboard.on("success",function(t){var e=t.trigger.parentNode.parentNode,n=e.querySelector(".swatch-card__copy-alert");n.classList.add("is-copied"),setTimeout(function(){n.classList.remove("is-copied")},1200)})}if(document.body.classList.contains("gradient-backgrounds"))var backgrounds=Backgrounds();!function(){$(".js-year")[0].innerText=(new Date).getFullYear();var t=$(".js-mobile-button")[0],e=$(".js-mobile-nav")[0];t.on("click",function(t){t.preventDefault(),e.classList.toggle("is-active")})}();