Update Koneko integration

This commit is contained in:
2025-06-24 09:23:51 -06:00
parent 46cb20ff09
commit 46baa99c0c
3271 changed files with 193256 additions and 4017 deletions

View File

@ -0,0 +1,16 @@
/*
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2018 ThemePunch
*/
.tp-bubblemorph {
background: transparent !important;
border: none !important;
box-shadow: none !important;
border-radius: 0 !important;
padding: 0 !important;
overflow: hidden !important;
}

View File

@ -0,0 +1,970 @@
/*
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2018 ThemePunch
*/
;(function() {
"use strict";
var $,
win;
window.BubbleMorphAddOn = function(_$, slider, carousel) {
if(!_$ || !slider) return;
$ = _$;
win = $(window);
$.event.special.rsBubbleMorphDestroyed = {remove: function(evt) {evt.handler();}};
return new BubbleMorph(slider, carousel);
};
function killBubbles() {
var $this = $(this),
bubbles = $this.data('bubbleaddon');
if(bubbles) {
bubbles.destroy();
$this.removeData('bubbleaddon');
}
}
function getValue(prop, level) {
if(!prop) return false;
if(level === 0) return prop[level];
var minus = level,
value = prop[level];
while(value === 'inherit') {
minus--;
if(minus > -1) value = prop[minus];
else value = prop[0];
}
return value;
}
function createBubbles() {
var $this = $(this),
bubbles = $this.data('bubbleaddon');
if(bubbles) killBubbles.call(this);
var bubbleObj = $this.data('bubbleObj');
if(!bubbleObj) return;
var levels = bubbleObj.levels,
len = levels.length,
width = win.width(),
level = 0,
scale,
prev,
levl;
if(levels) {
for(var i = 0; i < len; i++) {
levl = levels[i];
if(prev === levl) continue;
if(width < levl) level = i;
prev = levl;
}
}
var wid = bubbleObj.layerW[level],
high = bubbleObj.layerH[level],
fullW = wid === '100%' || wid === 'full',
fullH = high === '100%' || high === 'full';
if(!fullW) {
wid = parseInt(bubbleObj.layr.css('min-width'), 10);
}
else {
var elem = !bubbleObj.carousel || bubbleObj.isStatic ? bubbleObj.slider : bubbleObj.slotholder;
if(bubbleObj.fullAlign) {
wid = elem.width();
bubbleObj.wrapper[0].style.left = 0;
}
else {
scale = Math.min(bubbleObj.slider.width() / bubbleObj.grids[level], 1);
wid = bubbleObj.grids[level] * scale;
}
}
if(!fullH) {
high = parseInt(bubbleObj.layr.css('min-height'), 10);
}
else {
high = !bubbleObj.isStatic ? bubbleObj.slotholder.height() : bubbleObj.slider.height();
bubbleObj.wrapper[0].style.top = 0;
}
var blurStrength = getValue(bubbleObj.blurStrength, level),
borderSize = getValue(bubbleObj.borderSize, level),
borderColor = getValue(bubbleObj.borderColor, level),
blurColor = getValue(bubbleObj.blurColor, level),
blurX = getValue(bubbleObj.blurX, level),
blurY = getValue(bubbleObj.blurY, level),
bufferX = getValue(bubbleObj.bufferX, level),
bufferY = getValue(bubbleObj.bufferY, level),
numBubbles = getValue(bubbleObj.numBubbles, level),
velX = getValue(bubbleObj.velX, level),
velY = getValue(bubbleObj.velY, level);
var newBubble = RsAddOnBubbles(
wid,
high,
bubbleObj.slider,
bubbleObj.canvas,
parseInt(numBubbles, 10),
bubbleObj.color,
parseInt(blurStrength, 10),
blurColor,
parseInt(blurX, 10),
parseInt(blurY, 10),
borderColor,
parseInt(borderSize, 10),
parseInt(bufferX, 10),
parseInt(bufferY, 10),
parseFloat(velX),
parseFloat(velY)
);
$this.data('bubbleaddon', newBubble);
if($this.data('bubblesplaying')) playBubbles(newBubble, $this);
}
function playBubbles(bubbles, layr) {
bubbles.pause = false;
bubbles.screen.resize();
if(!bubbles.started) {
bubbles.started = true;
bubbles.inited();
}
layr.data('bubblesplaying', true);
bubbles.play();
}
function pauseBubbles(bubbles, layr) {
bubbles.pause = true;
layr.data('bubblesplaying', false);
}
function BubbleMorph(slider, carousel) {
this.slider = slider;
this.carousel = carousel;
slider.one('revolution.slide.onloaded', this.onLoaded.bind(this))
.one('rsBubbleMorphDestroyed', this.destroy.bind(this));
}
BubbleMorph.prototype = {
onLoaded: function() {
var i,
slider = this.slider,
carousel = this.carousel,
grids = slider[0].opt.gridwidth,
levels = slider[0].opt.responsiveLevels;
if(!Array.isArray(grids)) grids = [grids];
while(grids.length < 4) grids[grids.length] = grids[grids.length - 1];
for(i = 0; i < 4; i++) grids[i] = parseInt(grids[i], 10);
if(levels) {
if(!Array.isArray(levels)) levels = [levels];
while(levels.length < 4) levels[levels.length] = levels[levels.length - 1];
for(i = 0; i < 4; i++) levels[i] = parseInt(levels[i], 10);
}
this.morph = slider.find('.tp-bubblemorph').each(function() {
var $this = $(this),
canvas = $('<canvas />').appendTo($this),
bubbles = this.getAttribute('data-numbubbles'),
velX = this.getAttribute('data-bubblesspeedx'),
velY = this.getAttribute('data-bubblesspeedy'),
bufferX = this.getAttribute('data-bubblesbufferx'),
bufferY = this.getAttribute('data-bubblesbuffery'),
layerW = $this.attr('data-width').replace(/[[\]]/g, '').replace(/\'/g, '').split(','),
layerH = $this.attr('data-height').replace(/[[\]]/g, '').replace(/\'/g, '').split(',');
if(!Array.isArray(layerW)) layerW = [layerW];
if(!Array.isArray(layerH)) layerH = [layerH];
while(layerW.length < 4) layerW[layerW.length] = layerW[layerW.length - 1];
while(layerH.length < 4) layerH[layerH.length] = layerH[layerH.length - 1];
while(layerH.length < layerW.length) layerH[layerH.length] = layerH[layerH.length - 1];
while(layerW.length < layerH.length) layerH[layerW.length] = layerW[layerW.length - 1];
bubbles = bubbles.split('|');
bufferX = bufferX.split('|');
bufferY = bufferY.split('|');
velX = velX.split('|');
velY = velY.split('|');
var obj = {
velX: velX,
velY: velY,
layr: $this,
grids: grids,
layerW: layerW,
layerH: layerH,
slider: slider,
levels: levels,
bufferX: bufferX,
bufferY: bufferY,
canvas: canvas[0],
carousel: carousel,
numBubbles: bubbles,
wrapper: $this.closest('.tp-parallax-wrap'),
isStatic: $this.hasClass('tp-static-layer'),
color: processColor(this.getAttribute('data-bubblesbg')),
fullAlign: this.getAttribute('data-basealign') === 'slide',
slotholder: $this.closest('.tp-revslider-slidesli').find('.slotholder')
};
var blurStrength = this.getAttribute('data-bubblesblur');
if(blurStrength) {
obj.blurStrength = blurStrength.split('|');
obj.blurColor = $this.attr('data-bubblesblurcolor').split('|');
obj.blurX = $this.attr('data-bubblesblurx').split('|');
obj.blurY = $this.attr('data-bubblesblury').split('|');
}
var borderSize = this.getAttribute('data-bubblesbordersize');
if(borderSize) {
obj.borderSize = borderSize.split('|');
obj.borderColor = $this.attr('data-bubblesbordercolor').split('|');
}
$this.data('bubbleObj', obj);
});
if(this.morph.length) {
slider.on('revolution.slide.afterdraw', this.onResize.bind(this))
.on('revolution.slide.layeraction', this.layerAction.bind(this));
}
else {
this.destroy();
}
},
createBubbles: function() {
this.morph.each(createBubbles);
},
onResize: function(e) {
clearTimeout(this.resizeTimer);
this.morph.each(killBubbles);
this.resizeTimer = setTimeout(this.resize.bind(this), 250);
},
resize: function() {
this.morph.each(createBubbles);
},
layerAction: function(e, data) {
var bubbles = data.layer.data('bubbleaddon');
if(!bubbles) {
if(!data.layer.hasClass('tp-bubblemorph')) return;
else this.createBubbles();
}
bubbles = data.layer.data('bubbleaddon');
if(!bubbles.screen || !bubbles.screen.width || !bubbles.screen.height) {
createBubbles.call(data.layer);
bubbles = data.layer.data('bubbleaddon');
}
switch(data.eventtype) {
case 'enterstage':
playBubbles(bubbles, data.layer);
break;
case 'leftstage':
pauseBubbles(bubbles, data.layer);
break;
}
},
checkRemoved: function() {
// bounce if the slider has been removed from the DOM before the onloaded event fires
if(!this.slider || !document.body.contains(this.slider[0])) {
this.destroy();
return true;
}
return false;
},
destroy: function() {
this.slider.find('.tp-bubblemorph').each(function() {
var $this = $(this),
bubbles = $this.data('bubbleaddon');
bubbles.pause = true;
$this.removeData('bubbleaddon bubbleObj');
});
for(var prop in this) {
if(this.hasOwnProperty(prop)) delete this[prop];
}
}
};
/*
COLORS PROCESSING
*/
function sanitizeGradient(obj) {
var colors = obj.colors,
len = colors.length,
ar = [],
prev;
for(var i = 0; i < len; i++) {
var cur = colors[i];
delete cur.align;
if(prev) {
if(JSON.stringify(cur) !== JSON.stringify(prev)) ar[ar.length] = cur;
}
else {
ar[ar.length] = cur;
}
prev = cur;
}
obj.colors = ar;
return obj;
}
function processColor(clr) {
if(clr.trim() === 'transparent') {
return ['#FFFFFF', false];
}
else if(clr.search(/\[\{/) !== -1) {
try {
clr = JSON.parse(clr.replace(/\&/g, '"'));
clr = sanitizeGradient(clr);
return [clr, true];
}
catch(e) {
return ['#FFFFFF', false];
}
}
else if(clr.search('#') !== -1) {
return [clr, false];
}
else if(clr.search('rgba') !== -1) {
return [clr.replace(/\s/g, '').replace(/false/g, '1'), false];
}
else if(clr.search('rgb') !== -1) {
return [clr.replace(/\s/g, ''), false];
}
else {
return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(clr) ? [clr, false] : ['#FFFFFF', false];
}
}
function rgbaString(r, g, b, a) {
return 'rgba(' + r + ', ' + g + ', ' + b + ', ' + a + ')';
}
function radialGradient(ctx, w, h, colors) {
w *= 0.5;
h *= 0.5;
var gradient = ctx.createRadialGradient(w, h, 0, w, h, w),
len = colors.length,
color;
for(var i = 0; i < len; i++) {
color = colors[i];
gradient.addColorStop(color.position * 0.01, rgbaString(color.r, color.g, color.b, color.a));
}
return gradient;
}
function linearGradient(ctx, w, h, colors, angle) {
var tx = 0,
ty = 0,
bx = 0,
by = 0,
len;
angle = parseInt(angle, 10);
if(/0|90|180|270|360/.test(angle)) {
switch(angle) {
case 0:
case 360:
ty = h;
break;
case 90:
bx = w;
break;
case 180:
by = h;
break;
case 270:
tx = w;
break;
}
}
else {
w *= 0.5;
h *= 0.5;
var ang = (angle - 180) * (Math.PI / 180),
hypt = h / Math.cos(ang),
tr = w - Math.sqrt(hypt * hypt - h * h),
diag = Math.sin(ang) * tr;
len = hypt + diag;
tx = w + Math.cos(-Math.PI / 2 + ang) * len,
ty = h + Math.sin(-Math.PI / 2 + ang) * len,
bx = w + Math.cos( Math.PI / 2 + ang) * len,
by = h + Math.sin( Math.PI / 2 + ang) * len;
}
var gradient = ctx.createLinearGradient(Math.round(tx), Math.round(ty), Math.round(bx), Math.round(by)),
color,
pos;
len = colors.length;
for(var i = 0; i < len; i++) {
color = colors[i];
pos = parseInt(color.position, 10);
gradient.addColorStop(pos * 0.01, rgbaString(color.r, color.g, color.b, color.a));
}
return gradient;
}
/* ****************** */
/* begin bubble magic */
/* ****************** */
function RsAddOnBubbles(wid, high, slider, canvas, numBubbles, color, blurStrength, blurColor, blurX, blurY, borderColor, borderSize, bufferx, buffery, velX, velY) {
var lava0;
var ge1doot = {
screen: {
elem: null,
callback: null,
ctx: null,
width: 0,
height: 0,
left: 0,
top: 0,
init: function (callback, initRes) {
this.elem = canvas;
this.callback = callback || null;
if (this.elem.tagName == "CANVAS") this.ctx = this.elem.getContext("2d");
/*
window.addEventListener('resize', function () {
this.resize();
}.bind(this), false);
*/
this.elem.onselectstart = function () { return false; };
this.elem.ondrag = function () { return false; };
initRes && this.resize();
return this;
},
resize: function () {
var o = this.elem;
this.width = wid;
this.height = high;
for (this.left = 0, this.top = 0; o != null; o = o.offsetParent) {
this.left += o.offsetLeft;
this.top += o.offsetTop;
}
if (this.ctx) {
this.elem.width = this.width;
this.elem.height = this.height;
}
if(lava0) {
lava0.width = this.width;
lava0.height = this.height;
}
this.callback && this.callback();
},
destroy: function() {
for(var prop in this) if(this.hasOwnProperty(prop)) delete this[prop];
}
}
};
// Point constructor
var Point = function(x, y) {
this.x = x;
this.y = y;
this.magnitude = x * x + y * y;
this.computed = 0;
this.force = 0;
};
Point.prototype.add = function(p) {
return new Point(this.x + p.x, this.y + p.y);
};
// Ball constructor
var Ball = function(parent) {
var min = 0.1;
var max = 1.5;
this.vel = new Point(
(Math.random() > 0.5 ? 1 : -1) * (0.2 + Math.random() * velX),
(Math.random() > 0.5 ? 1 : -1) * (0.2 + Math.random() * velY)
);
this.pos = new Point(
parent.width * 0.2 + Math.random() * parent.width * 0.6,
parent.height * 0.2 + Math.random() * parent.height * 0.6
);
this.size = (parent.wh / 15) + ( Math.random() * (max - min) + min ) * (parent.wh / 15);
this.width = parent.width;
this.height = parent.height;
};
// move balls
Ball.prototype.move = function() {
// bounce borders
if (this.pos.x >= this.width - this.size - bufferx) {
if (this.vel.x > 0) this.vel.x = -this.vel.x;
this.pos.x = this.width - this.size - bufferx;
} else if (this.pos.x <= this.size + bufferx) {
if (this.vel.x < 0) this.vel.x = -this.vel.x;
this.pos.x = this.size + bufferx;
}
if (this.pos.y >= this.height - this.size - buffery) {
if (this.vel.y > 0) this.vel.y = -this.vel.y;
this.pos.y = this.height - this.size - buffery;
} else if (this.pos.y <= this.size + buffery) {
if (this.vel.y < 0) this.vel.y = -this.vel.y;
this.pos.y = this.size + buffery;
}
// velocity
this.pos = this.pos.add(this.vel);
};
// lavalamp constructor
var LavaLamp = function(width, height, numBalls, color) {
this.step = 5;
this.width = width;
this.height = height;
this.wh = Math.min(width, height);
this.sx = Math.floor(this.width / this.step);
this.sy = Math.floor(this.height / this.step);
this.paint = false;
this.metaFill = drawFill(width, height, color);
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.mscases = [0, 3, 0, 3, 1, 3, 0, 3, 2, 2, 0, 2, 1, 1, 0];
this.ix = [1, 0, -1, 0, 0, 1, 0, -1, -1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1];
this.grid = [];
this.balls = [];
this.iter = 0;
this.sign = 1;
// init grid
for (var i = 0; i < (this.sx + 2) * (this.sy + 2); i++) {
this.grid[i] = new Point(
(i % (this.sx + 2)) * this.step, (Math.floor(i / (this.sx + 2))) * this.step
);
}
// create metaballs
for (var k = 0; k < numBalls; k++) {
this.balls[k] = new Ball(this);
}
};
LavaLamp.prototype.destroy = function() {
var prop;
for(prop in this.balls) if(this.balls.hasOwnProperty(prop)) delete this.balls[prop];
for(prop in this) if(this.hasOwnProperty(prop)) delete this[prop];
};
// compute cell force
LavaLamp.prototype.computeForce = function(x, y, idx) {
var force;
var id = idx || x + y * (this.sx + 2);
if (x === 0 || y === 0 || x === this.sx || y === this.sy) {
force = 0.6 * this.sign;
} else {
force = 0;
var cell = this.grid[id];
if(!cell) return;
var i = 0;
var ball;
while (ball = this.balls[i++]) {
force += ball.size * ball.size / (-2 * cell.x * ball.pos.x - 2 * cell.y * ball.pos.y + ball.pos.magnitude + cell.magnitude);
}
force *= this.sign;
}
if(!this.grid[id]) return;
this.grid[id].force = force;
return force;
};
// compute cell
LavaLamp.prototype.marchingSquares = function(next) {
var x = next[0];
var y = next[1];
var pdir = next[2];
var id = x + y * (this.sx + 2);
if(!this.grid[id]) return;
if (this.grid[id].computed === this.iter) {
return false;
}
var dir, mscase = 0, toBounce;
// neighbors force
for (var i = 0; i < 4; i++) {
var idn = (x + this.ix[i + 12]) + (y + this.ix[i + 16]) * (this.sx + 2);
if(!this.grid[idn]) {
toBounce = true;
break;
}
var force = this.grid[idn].force;
if ((force > 0 && this.sign < 0) || (force < 0 && this.sign > 0) || !force) {
// compute force if not in buffer
force = this.computeForce(
x + this.ix[i + 12],
y + this.ix[i + 16],
idn
);
}
if (Math.abs(force) > 1) mscase += Math.pow(2, i);
}
if(toBounce) return;
if (mscase === 15) {
// inside
return [x, y - 1, false];
} else {
// ambiguous cases
if (mscase === 5) dir = (pdir === 2) ? 3 : 1;
else if (mscase === 10) dir = (pdir === 3) ? 0 : 2;
else {
// lookup
dir = this.mscases[mscase];
if(!this.grid[id]) return;
this.grid[id].computed = this.iter;
}
// draw line
var ix = this.step / (
Math.abs(Math.abs(this.grid[(x + this.plx[4 * dir + 2]) + (y + this.ply[4 * dir + 2]) * (this.sx + 2)].force) - 1) /
Math.abs(Math.abs(this.grid[(x + this.plx[4 * dir + 3]) + (y + this.ply[4 * dir + 3]) * (this.sx + 2)].force) - 1) + 1
);
ctx.lineTo(
this.grid[(x + this.plx[4 * dir]) + (y + this.ply[4 * dir]) * (this.sx + 2)].x + this.ix[dir] * ix,
this.grid[(x + this.plx[4 * dir + 1]) + (y + this.ply[4 * dir + 1]) * (this.sx + 2)].y + this.ix[dir + 4] * ix
);
this.paint = true;
// next
return [
x + this.ix[dir + 4],
y + this.ix[dir + 8],
dir
];
}
};
LavaLamp.prototype.renderMetaballs = function() {
var i = 0, ball;
while (ball = this.balls[i++]) ball.move();
// reset grid
this.iter++;
this.sign = -this.sign;
this.paint = false;
ctx.fillStyle = this.metaFill;
if(blurStrength) {
ctx.shadowBlur = blurStrength;
ctx.shadowColor = blurColor;
ctx.shadowOffsetX = blurX;
ctx.shadowOffsetY = blurY;
}
if(borderSize) {
ctx.strokeStyle = borderColor;
ctx.lineWidth = borderSize;
}
ctx.beginPath();
// compute metaballs
i = 0;
while (ball = this.balls[i++]) {
// first cell
var next = [
Math.round(ball.pos.x / this.step),
Math.round(ball.pos.y / this.step), false
];
// marching squares
do {
next = this.marchingSquares(next);
} while (next);
// fill and close path
if (this.paint) {
ctx.fill();
ctx.closePath();
if(borderSize) ctx.stroke();
ctx.beginPath();
this.paint = false;
}
}
};
var drawFill = function(w, h, color) {
if(color[1]) {
color = color[0];
if(color.type === 'radial') {
return radialGradient(ctx, w, h, color.colors);
}
else {
return linearGradient(ctx, w, h, color.colors, color.angle);
}
}
else {
return color[0];
}
};
// main loop
var run = function() {
if(!addonObj || addonObj.pause) return;
ctx.clearRect(0, 0, screen.width, screen.height);
lava0.renderMetaballs();
requestAnimationFrame(run);
};
// canvas
var screen = ge1doot.screen.init(null, true),
ctx = screen.ctx;
var inited = function() {
lava0 = new LavaLamp(screen.width, screen.height, numBubbles, color);
};
function destroy() {
addonObj.pause = true;
cancelAnimationFrame(run);
ctx.clearRect(0, 0, screen.width, screen.height);
if(lava0) lava0.destroy();
screen.destroy();
lava0 = null;
ge1doot = null;
Point = null;
Ball = null;
LavaLamp = null;
run = null;
screen = null;
addonObj = null;
inited = null;
drawFill = null;
ctx = null;
}
var addonObj = {
play: run,
pause: false,
screen: screen,
inited: inited,
started: false,
destroy: destroy
};
return addonObj;
}
})();

View File

@ -0,0 +1,27 @@
/*
* @author ThemePunch <info@themepunch.com>
* @link http://www.themepunch.com/
* @copyright 2018 ThemePunch
*/
;(function(){function E(){var b=r(this),a=b.data("bubbleaddon");a&&(a.destroy(),b.removeData("bubbleaddon"))}function n(b,a){if(!b)return!1;if(0===a)return b[a];for(var f=a,e=b[a];"inherit"===e;)f--,e=-1<f?b[f]:b[0];return e}function q(){var b=r(this);b.data("bubbleaddon")&&E.call(this);var a=b.data("bubbleObj");if(a){var f=a.levels,e=f.length,k=B.width(),c=0;if(f)for(var h=0;h<e;h++){var p=f[h];if(x!==p){k<p&&(c=h);var x=p}}f=a.layerW[c];e=a.layerH[c];e="100%"===e||"full"===e;"100%"!==f&&"full"!==
f?f=parseInt(a.layr.css("min-width"),10):(f=!a.carousel||a.isStatic?a.slider:a.slotholder,a.fullAlign?(f=f.width(),a.wrapper[0].style.left=0):(f=Math.min(a.slider.width()/a.grids[c],1),f*=a.grids[c]));e?(e=a.isStatic?a.slider.height():a.slotholder.height(),a.wrapper[0].style.top=0):e=parseInt(a.layr.css("min-height"),10);k=n(a.blurStrength,c);x=n(a.borderSize,c);p=n(a.borderColor,c);h=n(a.blurColor,c);var u=n(a.blurX,c),G=n(a.blurY,c),v=n(a.bufferX,c),l=n(a.bufferY,c),g=n(a.numBubbles,c),q=n(a.velX,
c);c=n(a.velY,c);a=I(f,e,a.slider,a.canvas,parseInt(g,10),a.color,parseInt(k,10),h,parseInt(u,10),parseInt(G,10),p,parseInt(x,10),parseInt(v,10),parseInt(l,10),parseFloat(q),parseFloat(c));b.data("bubbleaddon",a);b.data("bubblesplaying")&&C(a,b)}}function C(b,a){b.pause=!1;b.screen.resize();b.started||(b.started=!0,b.inited());a.data("bubblesplaying",!0);b.play()}function H(b,a){this.slider=b;this.carousel=a;b.one("revolution.slide.onloaded",this.onLoaded.bind(this)).one("rsBubbleMorphDestroyed",
this.destroy.bind(this))}function J(b){if("transparent"===b.trim())return["#FFFFFF",!1];if(-1!==b.search(/\[\{/))try{b=JSON.parse(b.replace(/&/g,'"'));for(var a=b.colors,f=a.length,e=[],k,c=0;c<f;c++){var h=a[c];delete h.align;k?JSON.stringify(h)!==JSON.stringify(k)&&(e[e.length]=h):e[e.length]=h;k=h}b.colors=e;return[b,!0]}catch(p){return["#FFFFFF",!1]}else return-1!==b.search("#")?[b,!1]:-1!==b.search("rgba")?[b.replace(/\s/g,"").replace(/false/g,"1"),!1]:-1!==b.search("rgb")?[b.replace(/\s/g,""),
!1]:/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(b)?[b,!1]:["#FFFFFF",!1]}function I(b,a,f,e,k,c,h,p,n,r,G,v,l,g,q,E){var w,x={screen:{elem:null,callback:null,ctx:null,width:0,height:0,left:0,top:0,init:function(d,a){this.elem=e;this.callback=d||null;"CANVAS"==this.elem.tagName&&(this.ctx=this.elem.getContext("2d"));this.elem.onselectstart=function(){return!1};this.elem.ondrag=function(){return!1};a&&this.resize();return this},resize:function(){var d=this.elem;this.width=b;this.height=a;for(this.top=
this.left=0;null!=d;d=d.offsetParent)this.left+=d.offsetLeft,this.top+=d.offsetTop;this.ctx&&(this.elem.width=this.width,this.elem.height=this.height);w&&(w.width=this.width,w.height=this.height);this.callback&&this.callback()},destroy:function(){for(var d in this)this.hasOwnProperty(d)&&delete this[d]}}},y=function(d,a){this.x=d;this.y=a;this.magnitude=d*d+a*a;this.force=this.computed=0};y.prototype.add=function(d){return new y(this.x+d.x,this.y+d.y)};var u=function(d){this.vel=new y((.5<Math.random()?
1:-1)*(.2+Math.random()*q),(.5<Math.random()?1:-1)*(.2+Math.random()*E));this.pos=new y(.2*d.width+Math.random()*d.width*.6,.2*d.height+Math.random()*d.height*.6);this.size=d.wh/15+d.wh/15*(1.4*Math.random()+.1);this.width=d.width;this.height=d.height};u.prototype.move=function(){this.pos.x>=this.width-this.size-l?(0<this.vel.x&&(this.vel.x=-this.vel.x),this.pos.x=this.width-this.size-l):this.pos.x<=this.size+l&&(0>this.vel.x&&(this.vel.x=-this.vel.x),this.pos.x=this.size+l);this.pos.y>=this.height-
this.size-g?(0<this.vel.y&&(this.vel.y=-this.vel.y),this.pos.y=this.height-this.size-g):this.pos.y<=this.size+g&&(0>this.vel.y&&(this.vel.y=-this.vel.y),this.pos.y=this.size+g);this.pos=this.pos.add(this.vel)};var A=function(d,a,b,e){this.step=5;this.width=d;this.height=a;this.wh=Math.min(d,a);this.sx=Math.floor(this.width/this.step);this.sy=Math.floor(this.height/this.step);this.paint=!1;this.metaFill=B(d,a,e);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.mscases=[0,3,0,3,1,3,0,3,2,2,0,2,1,1,0];this.ix=[1,0,-1,0,0,1,0,-1,-1,0,1,0,0,1,1,0,0,0,1,1];this.grid=[];this.balls=[];this.iter=0;this.sign=1;for(d=0;d<(this.sx+2)*(this.sy+2);d++)this.grid[d]=new y(d%(this.sx+2)*this.step,Math.floor(d/(this.sx+2))*this.step);for(d=0;d<b;d++)this.balls[d]=new u(this)};A.prototype.destroy=function(){for(var d in this.balls)this.balls.hasOwnProperty(d)&&delete this.balls[d];for(d in this)this.hasOwnProperty(d)&&delete this[d]};A.prototype.computeForce=function(d,
a,b){b=b||d+a*(this.sx+2);if(0===d||0===a||d===this.sx||a===this.sy)d=.6*this.sign;else{d=0;a=this.grid[b];if(!a)return;for(var e=0,z;z=this.balls[e++];)d+=z.size*z.size/(-2*a.x*z.pos.x-2*a.y*z.pos.y+z.pos.magnitude+a.magnitude);d*=this.sign}if(this.grid[b])return this.grid[b].force=d};A.prototype.marchingSquares=function(a){var d=a[0],b=a[1],e=a[2];a=d+b*(this.sx+2);if(this.grid[a]){if(this.grid[a].computed===this.iter)return!1;for(var c,f=0,h=0;4>h;h++){var g=d+this.ix[h+12]+(b+this.ix[h+16])*(this.sx+
2);if(!this.grid[g]){c=!0;break}var k=this.grid[g].force;if(0<k&&0>this.sign||0>k&&0<this.sign||!k)k=this.computeForce(d+this.ix[h+12],b+this.ix[h+16],g);1<Math.abs(k)&&(f+=Math.pow(2,h))}if(!c){if(15===f)return[d,b-1,!1];if(5===f)c=2===e?3:1;else if(10===f)c=3===e?0:2;else{c=this.mscases[f];if(!this.grid[a])return;this.grid[a].computed=this.iter}a=this.step/(Math.abs(Math.abs(this.grid[d+this.plx[4*c+2]+(b+this.ply[4*c+2])*(this.sx+2)].force)-1)/Math.abs(Math.abs(this.grid[d+this.plx[4*c+3]+(b+this.ply[4*
c+3])*(this.sx+2)].force)-1)+1);m.lineTo(this.grid[d+this.plx[4*c]+(b+this.ply[4*c])*(this.sx+2)].x+this.ix[c]*a,this.grid[d+this.plx[4*c+1]+(b+this.ply[4*c+1])*(this.sx+2)].y+this.ix[c+4]*a);this.paint=!0;return[d+this.ix[c+4],b+this.ix[c+8],c]}}};A.prototype.renderMetaballs=function(){for(var a=0,b;b=this.balls[a++];)b.move();this.iter++;this.sign=-this.sign;this.paint=!1;m.fillStyle=this.metaFill;h&&(m.shadowBlur=h,m.shadowColor=p,m.shadowOffsetX=n,m.shadowOffsetY=r);v&&(m.strokeStyle=G,m.lineWidth=
v);m.beginPath();for(a=0;b=this.balls[a++];){b=[Math.round(b.pos.x/this.step),Math.round(b.pos.y/this.step),!1];do b=this.marchingSquares(b);while(b);this.paint&&(m.fill(),m.closePath(),v&&m.stroke(),m.beginPath(),this.paint=!1)}};var B=function(a,b,c){if(c[1]){c=c[0];if("radial"===c.type){var d=c.colors;var e=.5*a;a=.5*b;e=m.createRadialGradient(e,a,0,e,a,e);a=d.length;for(c=0;c<a;c++)b=d[c],e.addColorStop(.01*b.position,"rgba("+b.r+", "+b.g+", "+b.b+", "+b.a+")");return e}e=m;d=c.colors;c=c.angle;
var f=0,h=0,k=0,g=0;c=parseInt(c,10);if(/0|90|180|270|360/.test(c))switch(c){case 0:case 360:h=b;break;case 90:k=a;break;case 180:g=b;break;case 270:f=a}else a*=.5,b*=.5,g=Math.PI/180*(c-180),c=b/Math.cos(g),c+=Math.sin(g)*(a-Math.sqrt(c*c-b*b)),f=a+Math.cos(-Math.PI/2+g)*c,h=b+Math.sin(-Math.PI/2+g)*c,k=a+Math.cos(Math.PI/2+g)*c,g=b+Math.sin(Math.PI/2+g)*c;e=e.createLinearGradient(Math.round(f),Math.round(h),Math.round(k),Math.round(g));c=d.length;for(f=0;f<c;f++)a=d[f],b=parseInt(a.position,10),
e.addColorStop(.01*b,"rgba("+a.r+", "+a.g+", "+a.b+", "+a.a+")");return e}return c[0]},F=function(){D&&!D.pause&&(m.clearRect(0,0,t.width,t.height),w.renderMetaballs(),requestAnimationFrame(F))},t=x.screen.init(null,!0),m=t.ctx,C=function(){w=new A(t.width,t.height,k,c)},D={play:F,pause:!1,screen:t,inited:C,started:!1,destroy:function(){D.pause=!0;cancelAnimationFrame(F);m.clearRect(0,0,t.width,t.height);w&&w.destroy();t.destroy();m=B=C=D=t=F=A=u=y=x=w=null}};return D}var r,B;window.BubbleMorphAddOn=
function(b,a,f){if(b&&a)return r=b,B=r(window),r.event.special.rsBubbleMorphDestroyed={remove:function(a){a.handler()}},new H(a,f)};H.prototype={onLoaded:function(){var b,a=this.slider,f=this.carousel,e=a[0].opt.gridwidth,k=a[0].opt.responsiveLevels;for(Array.isArray(e)||(e=[e]);4>e.length;)e[e.length]=e[e.length-1];for(b=0;4>b;b++)e[b]=parseInt(e[b],10);if(k){for(Array.isArray(k)||(k=[k]);4>k.length;)k[k.length]=k[k.length-1];for(b=0;4>b;b++)k[b]=parseInt(k[b],10)}this.morph=a.find(".tp-bubblemorph").each(function(){var b=
r(this),h=r("<canvas />").appendTo(b),p=this.getAttribute("data-numbubbles"),n=this.getAttribute("data-bubblesspeedx"),u=this.getAttribute("data-bubblesspeedy"),q=this.getAttribute("data-bubblesbufferx"),v=this.getAttribute("data-bubblesbuffery"),l=b.attr("data-width").replace(/[[\]]/g,"").replace(/'/g,"").split(","),g=b.attr("data-height").replace(/[[\]]/g,"").replace(/'/g,"").split(",");Array.isArray(l)||(l=[l]);for(Array.isArray(g)||(g=[g]);4>l.length;)l[l.length]=l[l.length-1];for(;4>g.length;)g[g.length]=
g[g.length-1];for(;g.length<l.length;)g[g.length]=g[g.length-1];for(;l.length<g.length;)g[l.length]=l[l.length-1];p=p.split("|");q=q.split("|");v=v.split("|");n=n.split("|");u=u.split("|");h={velX:n,velY:u,layr:b,grids:e,layerW:l,layerH:g,slider:a,levels:k,bufferX:q,bufferY:v,canvas:h[0],carousel:f,numBubbles:p,wrapper:b.closest(".tp-parallax-wrap"),isStatic:b.hasClass("tp-static-layer"),color:J(this.getAttribute("data-bubblesbg")),fullAlign:"slide"===this.getAttribute("data-basealign"),slotholder:b.closest(".tp-revslider-slidesli").find(".slotholder")};
if(p=this.getAttribute("data-bubblesblur"))h.blurStrength=p.split("|"),h.blurColor=b.attr("data-bubblesblurcolor").split("|"),h.blurX=b.attr("data-bubblesblurx").split("|"),h.blurY=b.attr("data-bubblesblury").split("|");if(p=this.getAttribute("data-bubblesbordersize"))h.borderSize=p.split("|"),h.borderColor=b.attr("data-bubblesbordercolor").split("|");b.data("bubbleObj",h)});if(this.morph.length)a.on("revolution.slide.afterdraw",this.onResize.bind(this)).on("revolution.slide.layeraction",this.layerAction.bind(this));
else this.destroy()},createBubbles:function(){this.morph.each(q)},onResize:function(b){clearTimeout(this.resizeTimer);this.morph.each(E);this.resizeTimer=setTimeout(this.resize.bind(this),250)},resize:function(){this.morph.each(q)},layerAction:function(b,a){var f=a.layer.data("bubbleaddon");if(!f)if(a.layer.hasClass("tp-bubblemorph"))this.createBubbles();else return;f=a.layer.data("bubbleaddon");f.screen&&f.screen.width&&f.screen.height||(q.call(a.layer),f=a.layer.data("bubbleaddon"));switch(a.eventtype){case "enterstage":C(f,
a.layer);break;case "leftstage":var e=a.layer;f.pause=!0;e.data("bubblesplaying",!1)}},checkRemoved:function(){return this.slider&&document.body.contains(this.slider[0])?!1:(this.destroy(),!0)},destroy:function(){this.slider.find(".tp-bubblemorph").each(function(){var a=r(this);a.data("bubbleaddon").pause=!0;a.removeData("bubbleaddon bubbleObj")});for(var b in this)this.hasOwnProperty(b)&&delete this[b]}}})();