"use strict";var _typeof="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};!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"===("undefined"==typeof module?"undefined":_typeof(module))&&module.exports?module.exports=function(i,s){return void 0===s&&(s="undefined"!=typeof window?require("jquery"):require("jquery")(i)),t(s),s}:t(jquery)}(function(t){return t.fn.tilt=function(i){var s=function(){this.ticking||(requestanimationframe(g.bind(this)),this.ticking=!0)},e=function(){var i=this;t(this).on("mousemove",o),t(this).on("mouseenter",a),this.settings.reset&&t(this).on("mouseleave",h),this.settings.glare&&t(window).on("resize",u.bind(i))},n=function(){var i=this;void 0!==this.timeout&&cleartimeout(this.timeout),t(this).css({transition:this.settings.speed+"ms "+this.settings.easing}),this.settings.glare&&this.glareelement.css({transition:"opacity "+this.settings.speed+"ms "+this.settings.easing}),this.timeout=settimeout(function(){t(i).css({transition:""}),i.settings.glare&&i.glareelement.css({transition:""})},this.settings.speed)},a=function(i){this.ticking=!1,t(this).css({"will-change":"transform"}),n.call(this),t(this).trigger("tilt.mouseenter")},r=function(i){return"undefined"==typeof i&&(i={pagex:t(this).offset().left+t(this).outerwidth()/2,pagey:t(this).offset().top+t(this).outerheight()/2}),{x:i.pagex,y:i.pagey}},o=function(t){this.mousepositions=r(t),s.call(this)},h=function(){n.call(this),this.reset=!0,s.call(this),t(this).trigger("tilt.mouseleave")},l=function(){var i=t(this).outerwidth(),s=t(this).outerheight(),e=t(this).offset().left,n=t(this).offset().top,a=(this.mousepositions.x-e)/i,r=(this.mousepositions.y-n)/s,o=(this.settings.maxtilt/2-a*this.settings.maxtilt).tofixed(2),h=(r*this.settings.maxtilt-this.settings.maxtilt/2).tofixed(2),l=math.atan2(this.mousepositions.x-(e+i/2),-(this.mousepositions.y-(n+s/2)))*(180/math.pi);return{tiltx:o,tilty:h,percentagex:100*a,percentagey:100*r,angle:l}},g=function(){return this.transforms=l.call(this),this.reset?(this.reset=!1,t(this).css("transform","perspective("+this.settings.perspective+"px) rotatex(0deg) rotatey(0deg)"),void(this.settings.glare&&(this.glareelement.css("transform","rotate(180deg) translate(-50%, -50%)"),this.glareelement.css("opacity","0")))):(t(this).css("transform","perspective("+this.settings.perspective+"px) rotatex("+("x"===this.settings.axis?0:this.transforms.tilty)+"deg) rotatey("+("y"===this.settings.axis?0:this.transforms.tiltx)+"deg) scale3d("+this.settings.scale+","+this.settings.scale+","+this.settings.scale+")"),this.settings.glare&&(this.glareelement.css("transform","rotate("+this.transforms.angle+"deg) translate(-50%, -50%)"),this.glareelement.css("opacity",""+this.transforms.percentagey*this.settings.maxglare/100)),t(this).trigger("change",[this.transforms]),void(this.ticking=!1))},c=function(){var i=this.settings.glareprerender;if(i||t(this).append('
'),this.glareelementwrapper=t(this).find(".js-tilt-glare"),this.glareelement=t(this).find(".js-tilt-glare-inner"),!i){var s={position:"absolute",top:"0",left:"0",width:"100%",height:"100%"};this.glareelementwrapper.css(s).css({overflow:"hidden"}),this.glareelement.css({position:"absolute",top:"50%",left:"50%","pointer-events":"none","background-image":"linear-gradient(0deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%)",width:""+2*t(this).outerwidth(),height:""+2*t(this).outerwidth(),transform:"rotate(180deg) translate(-50%, -50%)","transform-origin":"0% 0%",opacity:"0"})}},u=function(){this.glareelement.css({width:""+2*t(this).outerwidth(),height:""+2*t(this).outerwidth()})};return t.fn.tilt.destroy=function(){t(this).each(function(){t(this).find(".js-tilt-glare").remove(),t(this).css({"will-change":"",transform:""}),t(this).off("mousemove mouseenter mouseleave")})},t.fn.tilt.getvalues=function(){var i=[];return t(this).each(function(){this.mousepositions=r.call(this),i.push(l.call(this))}),i},t.fn.tilt.reset=function(){t(this).each(function(){var i=this;this.mousepositions=r.call(this),this.settings=t(this).data("settings"),h.call(this),settimeout(function(){i.reset=!1},this.settings.transition)})},this.each(function(){var s=this;this.settings=t.extend({maxtilt:t(this).is("[data-tilt-max]")?t(this).data("tilt-max"):20,perspective:t(this).is("[data-tilt-perspective]")?t(this).data("tilt-perspective"):300,easing:t(this).is("[data-tilt-easing]")?t(this).data("tilt-easing"):"cubic-bezier(.03,.98,.52,.99)",scale:t(this).is("[data-tilt-scale]")?t(this).data("tilt-scale"):"1",speed:t(this).is("[data-tilt-speed]")?t(this).data("tilt-speed"):"400",transition:!t(this).is("[data-tilt-transition]")||t(this).data("tilt-transition"),axis:t(this).is("[data-tilt-axis]")?t(this).data("tilt-axis"):null,reset:!t(this).is("[data-tilt-reset]")||t(this).data("tilt-reset"),glare:!!t(this).is("[data-tilt-glare]")&&t(this).data("tilt-glare"),maxglare:t(this).is("[data-tilt-maxglare]")?t(this).data("tilt-maxglare"):1},i),this.init=function(){t(s).data("settings",s.settings),s.settings.glare&&c.call(s),e.call(s)},this.init()})},t("[data-tilt]").tilt(),!0});