File: /var/www/html/wp-content/plugins/revslider-bubblemorph-addon/public/js/bubblemorph.min.js
/**
* @preserve
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2018 ThemePunch
* @version 6.7.0
*/
!function(){"use strict";window.SR7??={},window._tpt??={},SR7.A??={},SR7.F??={},SR7.D??={},void 0===SR7.A.bubblemorph&&(SR7.A.bubblemorph={style:".tp-bubblemorph {background: none transparent !important; border: none !important; box-shadow: none !important; border-radius: 0 !important; padding: 0 !important; overflow: hidden !important;}",getModuleBasics:(t={},e)=>({u:"compare"==e?void 0:t.u??t.enable??!0}),getLayerBasics:(t={},e)=>({u:"compare"==e?void 0:t.u??t.enable??!0,s:{m:t?.s?.m??_tpt.DNTMtoArr(t?.settings?.maxmorphs??6),sX:t?.s?.sX??_tpt.DNTMtoArr(t?.settings?.speedx??.25),sY:t?.s?.sY??_tpt.DNTMtoArr(t?.settings?.speedy??1),bX:t?.s?.bX??_tpt.DNTMtoArr(t?.settings?.bufferx??0),bY:t?.s?.bY??_tpt.DNTMtoArr(t?.settings?.buffery??0)},shd:{s:t?.shd?.s??_tpt.DNTMtoArr(t?.shadow?.strength??0),c:t?.shd?.c??_tpt.DNTMtoArr(t?.shadow?.color??"rgba(0, 0, 0, 0.35)"),oX:t?.shd?.oX??_tpt.DNTMtoArr(t?.shadow?.offsetx??0),oY:t?.shd?.oY??_tpt.DNTMtoArr(t?.shadow?.offsety??0)},b:{s:t?.b?.s??_tpt.DNTMtoArr(t?.border?.size??0),c:t?.b?.c??_tpt.DNTMtoArr(t?.border?.color??"#000000")}}),init:t=>{void 0===SR7.A.bubblemorphcss&&(_tpt.injectCssJs(SR7.A.bubblemorph.style,void 0,void 0,"bubblemorph_global_styles"),SR7.A.bubblemorphcss=!0),SR7.A.bubblemorph.listeners.init(t)},listeners:{init:t=>{_tpt.resizeObserver.observe((t=>{SR7.A.bubblemorph.resized(t)}),19,t),SR7.A.bubblemorph.listenersAdded||(document.addEventListener("sr.layer.action",(function(t){if("bubblemorph"!==t.layersettings?.subtype||!t.layersettings?.addOns?.bubblemorph?.u)return;let e=t.c.addOns.bubblemorph;switch(t.eventtype){case"enterstage":e.bubble||SR7.A.bubblemorph.createBubbles(t.layerid),e.bubble&&e.bubble.paused&&e.bubble.screen&&e.bubble.screen.resize&&SR7.A.bubblemorph.playBubbles(t.id,t.layerid);break;case"leftstage":e.bubble&&SR7.A.bubblemorph.pauseBubbles(t.id,t.layerid,!1)}})),SR7.A.bubblemorph.listenersAdded=!0)}},resized:t=>{if(SR7.A?.bubblemorph?.bubbles?.[t])for(let e in SR7.A.bubblemorph.bubbles[t])_tpt.hop(SR7.A.bubblemorph.bubbles[t],e)&&SR7.A.bubblemorph.bubbles[t][e]&&requestAnimationFrame((()=>{SR7.A.bubblemorph.createBubbles(e)}))},toggle:(t,e)=>{if(!SR7.A?.bubblemorph?.bubbles?.[t])return;const s=SR7.M[t];for(let e in SR7.A.bubblemorph.bubbles[t])_tpt.hop(SR7.A.bubblemorph.bubbles[t],e)&&SR7.A.bubblemorph.bubbles[t][e]&&SR7.A.bubblemorph[(s.states.inViewPort?"play":"pause")+"Bubbles"](t,e,!0)},prepareLayer:(t,e,s)=>{const i=e?.addOns?.bubblemorph;if("bubblemorph"!==e?.subtype||!i?.u)return;let b=SR7.M[t].c.layers[s];b.addOns??={},b.addOns.bubblemorph??={},e.addOns.bubblemorph=SR7.A.bubblemorph.getLayerBasics(i,"normalize"),b.addOns.bubblemorph.canvas=new SR7.F.canvas({wrap:b.el,width:"100%",height:"100%",color:e.bg?.color??"transparent",ctx:"2d"}),b.el.appendChild(b.addOns.bubblemorph.canvas.canvas)},createBubbles:t=>{const{id:e,layer:s,c:i}=SR7.F.getLayer(t),b=s.addOns?.bubblemorph,h=i.addOns.bubblemorph;b?.u&&(h.bubble&&SR7.A.bubblemorph.killBubbles(e,t,h),h.bubble=function(t,e,s,i,b,h,l,r,o,a,n,u,d,p,c){var m,g={screen:{elem:null,callback:null,ctx:null,width:0,height:0,left:0,top:0,init:function(t,e){return this.elem=s.canvas,this.callback=t||null,"CANVAS"==this.elem.tagName&&(this.ctx=s.ctx),this.elem.onselectstart=function(){return!1},this.elem.ondrag=function(){return!1},e&&this.resize(),this},resize:function(){var s=this.elem;for(this.width=t,this.height=e,this.left=0,this.top=0;null!=s;s=s.offsetParent)this.left+=s.offsetLeft,this.top+=s.offsetTop;this.ctx&&(this.elem.width=this.width,this.elem.height=this.height),m&&(m.width=this.width,m.height=this.height),this.callback&&this.callback()},destroy:function(){for(let t in this)this.hasOwnProperty(t)&&delete this[t]}}},f=function(t,e){this.x=t,this.y=e,this.magnitude=t*t+e*e,this.computed=0,this.force=0};f.prototype.add=function(t){return new f(this.x+t.x,this.y+t.y)};class y{constructor(t){const e=.1,s=1.5,i=()=>Math.random()>.5?1:-1;this.vel=new f(i()*(.2+Math.random()*d),i()*(.2+Math.random()*p)),this.pos=new f(.2*t.width+Math.random()*t.width*.6,.2*t.height+Math.random()*t.height*.6),this.size=t.wh/Math.min(30,15/c)+(Math.random()*(s-e)+e)*(t.wh/Math.min(30,15/c)),this.width=t.width,this.height=t.height}move(){const t=(t,e,s,i)=>t>=s-e-i?{newPosition:s-e-i,velocityFactor:-1}:t<=e+i?{newPosition:e+i,velocityFactor:-1}:{newPosition:t,velocityFactor:1},e=t(this.pos.x,this.size,this.width,n),s=t(this.pos.y,this.size,this.height,u);this.vel.x*=e.velocityFactor,this.vel.y*=s.velocityFactor,this.pos.x=e.newPosition,this.pos.y=s.newPosition,this.pos=this.pos.add(this.vel)}destroy(){Object.keys(this).forEach((t=>delete this[t]))}}class R{constructor(t,e,s){this.width=t,this.height=e,this.wh=Math.min(t,e),this.step=5,this.sx=Math.floor(t/this.step),this.sy=Math.floor(e/this.step),this.paint=!1,this.metaFill=S(t,e),this.iter=0,this.sign=1,this.grid=Array((this.sx+2)*(this.sy+2)).fill(null).map(((t,e)=>new f(e%(this.sx+2)*this.step,Math.floor(e/(this.sx+2))*this.step))),this.balls=Array(s).fill(null).map((()=>new y(this))),this.mscases=[0,3,0,3,1,3,0,3,2,2,0,2,1,1,0],this.plx=[0,0,1,0,1,1,1,1,1,1,0,1,0,0,0,0],this.ply=[0,0,0,0,0,0,1,0,0,1,1,1,0,1,0,1],this.ix=[1,0,-1,0,0,1,0,-1,-1,0,1,0,0,1,1,0,0,0,1,1]}destroy(){this.balls.forEach((t=>Object.keys(t).forEach((e=>delete t[e])))),Object.keys(this).forEach((t=>delete this[t]))}computeForce(t,e,s){var i,b=s||t+e*(this.sx+2);if(0===t||0===e||t===this.sx||e===this.sy)i=.6*this.sign;else{i=0;var h=this.grid[b];if(!h)return;for(var l,r=0;l=this.balls[r++];)i+=l.size*l.size/(-2*h.x*l.pos.x-2*h.y*l.pos.y+l.pos.magnitude+h.magnitude);i*=this.sign}if(this.grid[b])return this.grid[b].force=i,i}marchingSquares([t,e,s]){const i=t+e*(this.sx+2);if(!this.grid[i]||this.grid[i].computed===this.iter)return!1;let b,h=0,l=!1;for(let s=0;s<4;s++){const i=t+this.ix[s+12]+(e+this.ix[s+16])*(this.sx+2);if(!this.grid[i]){l=!0;break}let b=this.grid[i].force;(b>0&&this.sign<0||b<0&&this.sign>0||!b)&&(b=this.computeForce(t+this.ix[s+12],e+this.ix[s+16],i)),Math.abs(b)>1&&(h+=1<<s)}if(l)return;if(15===h)return[t,e-1,!1];if(5===h)b=2===s?3:1;else if(10===h)b=3===s?0:2;else{if(b=this.mscases[h],!this.grid[i])return;this.grid[i].computed=this.iter}const r=this.grid[t+this.plx[4*b+2]+(e+this.ply[4*b+2])*(this.sx+2)].force,o=this.grid[t+this.plx[4*b+3]+(e+this.ply[4*b+3])*(this.sx+2)].force,a=this.step/(Math.abs(Math.abs(r)-1)/Math.abs(Math.abs(o)-1)+1);return x.lineTo(this.grid[t+this.plx[4*b]+(e+this.ply[4*b])*(this.sx+2)].x+this.ix[b]*a,this.grid[t+this.plx[4*b+1]+(e+this.ply[4*b+1])*(this.sx+2)].y+this.ix[b+4]*a),this.paint=!0,[t+this.ix[b+4],e+this.ix[b+8],b]}renderMetaballs(){this.balls.forEach((t=>t.move())),this.iter++,this.sign=-this.sign,this.paint=!1,x.fillStyle=this.metaFill,b&&(x.shadowBlur=b,x.shadowColor=h,x.shadowOffsetX=l,x.shadowOffsetY=r),a&&(x.strokeStyle=o,x.lineWidth=a),x.beginPath(),this.balls.forEach((t=>{let e=[Math.round(t.pos.x/this.step),Math.round(t.pos.y/this.step),!1];do{e=this.marchingSquares(e)}while(e);this.paint&&(x.fill(),x.closePath(),a&&x.stroke(),x.beginPath(),this.paint=!1)}))}}let S=(t,e)=>(s.width!==t&&(s.width=t),s.height!==e&&(s.height=e),s.fillColor());var w=function(){_&&!_.paused&&(x.clearRect(0,0,A.width,A.height),m.renderMetaballs(),requestAnimationFrame(w))},A=g.screen.init(null,!0),x=A.ctx,M=function(){m&&m.destroy(),m=new R(A.width,A.height,i)};function v(){_.paused=!0,cancelAnimationFrame(w),x.clearRect(0,0,A.width,A.height),m&&m.destroy(),A.destroy(),m=null,g=null,f=null,y=null,R=null,w=null,A=null,_=null,M=null,S=null,x=null}var _={play:w,paused:!0,screen:A,inited:M,started:!1,destroy:v,height:e,width:t};return _}(i.cw,i.ch,h.canvas,SR7.gVal(b.s.m,e,0),SR7.gVal(b.shd.s,e,0),SR7.gVal(b.shd.c,e,0),SR7.gVal(b.shd.oX,e,0),SR7.gVal(b.shd.oY,e,0),SR7.gVal(b.b.c,e,0),SR7.gVal(b.b.s,e,0),SR7.gVal(b.s.bX,e,0),SR7.gVal(b.s.bY,e,0),SR7.gVal(b.s.sX,e,0),SR7.gVal(b.s.sY,e,0),SR7.M[e].MP),h.bubblesplaying&&SR7.A.bubblemorph.playBubbles(e,t),SR7.A.bubblemorph.bubbles??={},SR7.A.bubblemorph.bubbles[e]??={},SR7.A.bubblemorph.bubbles[e][t]=!0)},killBubbles:(t,e,s)=>{delete SR7.A.bubblemorph.bubbles[t][e],s.bubble.destroy(),delete s.bubble},playBubbles:(t,e)=>{let s=SR7.M[t].c.layers[e].addOns.bubblemorph;SR7.A.bubblemorph.bubbles[t][e]=!0,s.bubble.paused=!1,s.bubble.screen.resize(),s.bubble.started||(s.bubble.started=!0,s.bubble.inited()),s.bubblesplaying=!0,s.bubble.play()},pauseBubbles:(t,e,s)=>{let i=SR7.M[t].c.layers[e].addOns.bubblemorph;SR7.A.bubblemorph.bubbles[t][e]=s,i.bubble.paused=!0,i.bubblesplaying=!1}},_tpt.R??={},_tpt.R.bubblemorph=_tpt.extend?_tpt.extend(_tpt.R.bubblemorph,{status:2,version:"1.0"}):{status:2,version:"1.0"},window.dispatchEvent(new CustomEvent("SR7BubbleMorphReady")))}();