function showResponse(result) {
//sets the payment type
window.payment_options = document.getElementById('payment_div').innerHTML;
document.getElementById('payment_div').innerHTML = result;
document.getElementById('back_to_payment_options').style.display = 'block';
window.last_payment_amount = document.getElementById('amount').value;
//check ok + do action
if(result.indexOf('RES:OK:wechat')>-1) {
tmp = result.split('RES:OK:wechat[:]');
tmp = tmp[1].split('[:]');
AjaxCall('?atf-payment&p=43t3tfvsdfewrf&type=create_payment_request&provider=wechat&local_id='+window.uniqueid+'&item_name='+tmp[0]+'&item_id='+tmp[1]+'&item_amount='+tmp[2]+'&item_currency='+tmp[3],false,'qrCodeHandling');
setInterval(function() { checkUpdate(purchase_desc,purchase_id,currency); }, 1000);
}
if(result.indexOf('RES:OK:card')>-1) {
tmp = result.split('RES:OK:card[:]');
tmp = tmp[1].split('[:]');
}
if(result.indexOf('RES:OK:paypal')>-1) {
//start pinging atf every 2 seconds for an update
window.paid = false;
setInterval(function() { AjaxCall('?atf-payment&p=43t3tfvsdfewrf&type=check_payment&uniqueid='+window.uniqueid,false,'paymentResponse'); }, 2000);
}
if(result.indexOf('RES:OK:alipay')>-1) {
//start pinging atf every 2 seconds for an update
window.paid = false;
setInterval(function() { AjaxCall('?atf-payment&p=43t3tfvsdfewrf&type=check_payment&uniqueid='+window.uniqueid,false,'paymentResponse'); }, 2000);
}
}
function checkUpdate() {
if(window.last_payment_amount!=document.getElementById('amount').value) {
clearInterval(window.check_payment_handle);
AjaxCall('?new_payment_request&type='+window.last_payment_type+'&price='+document.getElementById('amount').value+'&desc='+document.getElementById('purchase_desc').value+'¤cy='+document.getElementById('currency').value+'&id='+document.getElementById(purchase_id).value,false,'showResponse');
}
}
function cardPaymentHandling(result) {
//it worked or it didnt
if(result.indexOf('<[RES[OK')>-1) {
paymentSuccessful();
} else {
document.getElementById('status_image').src = 'https://cdn.atfgroup.com.cn/l4CK7K7N5YpGfJwKnyRXLOQLGgA9Eq7R.png';
document.getElementById('status_image').width = '110';
document.getElementById('status_image').height = '100%';
document.getElementById('payment_status').innerHTML = 'Sorry, your payment was not accepted. try again ';
}
}
function paymentSuccessful() {
document.getElementById('status_image').src = 'https://cdn.atfgroup.com.cn/FtaTgKhXMlAlecKoiKky3J6TzYQ0i7Ct.png';
document.getElementById('status_image').width = '115';
document.getElementById('status_image').height = '115';
document.getElementById('payment_status').innerHTML = 'Payment successful!';
document.getElementById('back_to_payment_options').style.display = 'none';
window.paid = true;
clearInterval();
}
function reloadPaymentOptions() {
if(window.payment_options!='') {
document.getElementById('payment_div').innerHTML = window.payment_options;
//reload stripe scripts
showCardPayment();
}
}
function checkPaymentSuccess(payment_id) {
//ping paymentid back, is it paid yet? payment_id
AjaxCall('?atf-payment&p=43t3tfvsdfewrf&type=check_payment&payment_id='+payment_id,false,'paymentResponse');
}
function paymentResponse(payload) {
if(payload.indexOf('<[RES[PAID')>-1) {
if(!window.paid) {
paymentSuccessful();
}
}
}
function qrCodeHandling(payload) {
if(payload.indexOf('<[RES[SUCCESS[[')>-1) {
tmp = payload.split('SUCCESS[[');
tmp = tmp[1].split(']]]');
payload = JSON.parse(tmp[0]);
document.getElementById('status_image').src = payload['qr_code'];
//ping every 2 seconds for an update for payment
window.paid = false;
window.check_payment_handle = setInterval(function() { checkPaymentSuccess(payload.payment_id); }, 4000);
}
}
function showCardPayment() {
window.paymentHandler = StripeCheckout.configure({
key: 'pk_live_c6Pocns6JlCg5svExofTLjbP',
image: 'https://stripe.com/img/documentation/checkout/marketplace.png',
locale: 'auto',
token: function(token) {
//show charging card message and send token to core
document.getElementById('payment_status').innerHTML = 'Charging your card... please wait';
AjaxCall('?type=charge_card&uniqueid='+window.uniqueid+'&token='+token.id,false,'cardPaymentHandling');
}
});
document.getElementById('cardPayment').addEventListener('click', function(e) {
window.last_payment_type='card';
// Open Checkout with further options:
window.paymentHandler.open({
name: document.getElementById('purchase_desc').value,
description: document.getElementById('purchase_desc').value,
currency: document.getElementById('currency').value,
amount: parseFloat(document.getElementById('amount').value+"00")
});
// send update to us
AjaxCall('?new_payment_request&type=card&price='+document.getElementById('amount').value+'&desc='+document.getElementById('purchase_desc').value+'¤cy='+document.getElementById('currency').value+'&id='+document.getElementById('purchase_id').value,false,'showResponse');
e.preventDefault();
});
// Close Checkout on page navigation:
window.addEventListener('popstate', function() {
window.paymentHandler.close();
});
}
function loadScript(url, callback){
var script = document.createElement("script");
script.type = "text/javascript";
if (script.readyState){ //IE
script.onreadystatechange = function(){
if (script.readyState == "loaded" ||
script.readyState == "complete"){
script.onreadystatechange = null;
callback();
}
};
} else { //Others
script.onload = function(){
callback();
};
}
script.src = url;
document.getElementsByTagName("head")[0].appendChild(script);
}
window.job_title = '';
window.account_id = 0;
window.stored_html = '';
function showLogin() {
window.login_div = createWindow("Login", '
Login Haven\'t registered yet? register.
');
//detect enter key press
detectKeyPress('lbpass','doLogin');
//login leadbox animate start
/**var current = null;
document.getElementById('lbemail').addEventListener('focus', function(e) {
if (current) current.pause();
current = anime({
targets: '.check1',
strokeDashoffset: {
value: 0,
duration: 700,
easing: 'easeOutQuart'
},
strokeDasharray: {
value: '240 1386',
duration: 700,
easing: 'easeOutQuart'
}
});
});
document.getElementById('lbpass').addEventListener('focus', function(e) {
if (current) current.pause();
current = anime({
targets: '.check1',
strokeDashoffset: {
value: -336,
duration: 700,
easing: 'easeOutQuart'
},
strokeDasharray: {
value: '240 1386',
duration: 700,
easing: 'easeOutQuart'
}
});
}); **/
//login leadbox animate end
};
function doLogin() {
window.username = document.getElementById('lbemail').value;
password = document.getElementById('lbpass').value;
if(window.username.length>3&&password.length>3) {
//show waiting
window.stored_html = document.getElementById('login_div').innerHTML;
if(document.getElementById('login_button')){
//if login_button, just change that
document.getElementById('login_button').value = "Logging in...";
document.getElementById('login_button').disabled = true;
} else {
document.getElementById('login_div').innerHTML = ' Checking credentials...';
}
AjaxCall("?atf_do_login&username="+btoa(encodeURIComponent(window.username))+"&password="+btoa(encodeURIComponent(password)),false,"loginReply");
} else {
if(document.getElementById('lbpass').value==''&&/^\d+$/.test(document.getElementById('lbemail').value)&&document.getElementById('lbemail').value.length>6) {
sendCode();
} else {
message = 'Please enter your phone number / username and password.';
if(document.getElementById('lbpass').placeholder=='密码'||window.lang=='cn') {
window.lang = 'cn';
message = '请输入您的电话号码和密码。';
}
document.getElementById('code_error').innerHTML = message;
}
}
};
function loginReply(data) {
if(data.indexOf('[RES[OK')>-1) {
//show success
//document.getElementById('biscuitsDialog').style.textAlign = 'center';
//document.getElementById('biscuitsDialog').style.padding = '8px';
if(document.getElementById('login_success')){
document.getElementById('login_success').innerHTML = "Login successful!
";
document.getElementById('login_success').style.textAlign = 'center';
} else {
document.getElementById('login_div').innerHTML = "Login successful!
";
document.getElementById('login_div').style.textAlign = 'center';
}
window.loggedin = true;
//get the account_id
tmp = data.split('[OK:');
tmp = tmp[1].split(']]');
window.account_id = tmp[0];
if(window.job_id>0) {
sendAccountDetailsToClient(window.job_id,window.employer_id,window.job_title);
}
//wait 1 seconds and reload
setTimeout(function(){
window.location.reload(1);
}, 1000);
} else {
document.getElementById('login_div').innerHTML = window.stored_html;
document.getElementById('lbemail').value = window.username;
window.stored_html = '';
document.getElementById('code_error').innerHTML = "Sorry your username or password is incorrect.";
}
};
function sendAccountDetailsToClient(job_id,employer_id,account_id,job_title) {
//show applying
closeRegister();
var div = document.createElement('div');
div.setAttribute('id','biscuitsDialog');
div.style.position = 'fixed';
div.style.zIndex = '20';
div.style.background = '#fff';
div.style.color = 'black';
div.style.boxShadow = '2px 3px 2px #dde2ea';
div.style.textAlign = 'center';
div.style.padding = '8px';
div.style.paddingBottom = '25px';
document.body.appendChild(div);
document.getElementById('biscuitsDialog').innerHTML = " Sending your application to the employer...";
try {
centerDialog('biscuitsDialog');
} catch(err) {}
account_details = "";
if(typeof account_id != null&&account_id>0) {
account_details = "&account_id="+account_id;
}
if(typeof job_title != null&&job_title!='') {
account_details += "&title="+btoa(job_title);
}
if(typeof window.subject_prefix != null&&window.subject_prefix!='') {
account_details += "&subject_prefix="+btoa(window.subject_prefix);
}
AjaxCall("?atf_send_application&job_id="+job_id+"&employer_id="+employer_id+account_details,false,"applicationReply");
};
function applicationReply(reply) {
if(reply.indexOf('ERROR:notloggedin')>-1) {
showLogin();
} else if(reply.indexOf('RES[nocv]')>-1) {
showFinalStep();
} else if(reply.indexOf('RES[alreadyapplied]')>-1) {
document.getElementById('biscuitsDialog').innerHTML = " You\'ve already applied for this job. Please wait for a reply from the employer shortly.";
} else if(reply.indexOf('RES[OK')>-1) {
document.getElementById('biscuitsDialog').innerHTML = " Application sent successfully!";
} else {
document.getElementById('biscuitsDialog').innerHTML = " Sorry, we couldnt process your application right now, please try again.";
}
if(reply.indexOf('ERROR:notloggedin')==-1) {
window.loggedin = true;
}
try {
centerDialog('biscuitsDialog');
} catch(err) {
console.log("Dialog Error check")
}
};
function isLoggedIn() {
if(!window.loggedin) {
return window.loggedin;
} else {
return true;
}
};
function closeRegister() {
if(document.getElementById('biscuitsDialog')) {
var elem = document.getElementById("biscuitsDialog");
elem.parentElement.removeChild(elem);
}
};
function doFinalizeAccount() {
//handle file
var fileSelect = document.getElementById('cv');
var files = fileSelect.files;
var formData = new FormData();
var validated = true;
var validationErrors = '';
// Loop through each of the selected files.
var filesAttachedCount = 0;
for (var i = 0; i < files.length; i++) {
var file = files[i];
// Check the file type.
if (file.name.indexOf('.doc')==-1&&file.name.indexOf('.docx')==-1&&file.name.indexOf('.pdf')==-1&&file.name.indexOf('*.txt')==-1&&file.name.indexOf('.odt')==-1) {
validationErrors += 'Sorry, could not add file: '+file.name+' because it is not a .doc, .docx, .pdf, .odt or .txt file';
continue;
}
// Add the file to the request.
formData.append('cvs[]', file, file.name);
filesAttachedCount++;
}
//sort out qualification and nationality
nationality = document.getElementById('lbnationality').value;
if(document.getElementById('lbnationality').value=='other') {
nationality = document.getElementById('lbnationalitycustom').value;
}
qualification = document.getElementById('lbqualification').value;
if(document.getElementById('lbqualification').value=='other') {
qualification = document.getElementById('lbqualificationcustom').value;
}
//validation
if(!(qualification.length>1)) {
validated = false;
validationErrors += 'You must select a qualification ';
} else if(!(nationality.length>3)) {
validated = false;
validationErrors += 'You must select your nationality ';
} else if(!(filesAttachedCount>0)) {
validated = false;
validationErrors += 'You must choose your C.V. or resume ';
}
if(validated) {
// add nationality and qualification
formData.append('nationality', nationality);
formData.append('qualification', qualification);
formData.append('id', window.account_id);
//send data
AjaxPostCall('?upload_cv_nationality_qualification',formData,'doAccountFinalStep');
} else {
document.getElementById('code_error').innerHTML = "Sorry, please check the following and click done again: "+validationErrors;
}
};
function doAccountFinalStep(res) {
if (res.indexOf('RES[OK')>-1) {
//handle final action
if(window.job_id>0) {
sendAccountDetailsToClient(window.job_id,window.employer_id,window.account_id);
} else {
//show success message
document.getElementById('biscuitsDialog').style.textAlign = 'center';
document.getElementById('biscuitsDialog').style.padding = '8px';
document.getElementById('biscuitsDialog').innerHTML = " Registration success!";
}
} else {
document.getElementById('code_error').innerHTML = 'Sorry, that didn\'t work, please try again.';
}
};
function doNationality() {
if(document.getElementById('lbnationality').value=='other') {
document.getElementById('lbnationality').style.display = 'none';
document.getElementById('lbnationalitycustom').style.display = 'block';
}
};
function doQualification() {
if(document.getElementById('lbqualification').value=='other') {
document.getElementById('lbqualification').style.display = 'none';
document.getElementById('lbqualificationcustom').style.display = 'block';
}
};
function showFinalStep() {
//go to next step
div_html = "Your nationality: - select - Australian Canadian Irish New Zealander South African United States of America United Kingdom Other Highest qualification: - select - High School (Or High School Equivalent) Bachelor Degree Master Degree Doctorate (PHD) Diploma Related Certificate Other Upload C.V. or Resume ";
try {
document.getElementById('registration_fields').innerHTML = div_html;
} catch(err) {
document.getElementById('biscuitsDialog').innerHTML = 'Please complete your details to continue:
'+div_html;
document.getElementById('biscuitsDialog').style.width = '200px';
document.getElementById('biscuitsDialog').style.textAlign = 'left';
}
detectKeyPress('cv','doFinalizeAccount');
};
function _accountSettings(title, contentHtmlorLink) {
//open a popup and point it at core
createWindow(title, contentHtmlorLink);
};
function codeReply(res) {
if (res.indexOf('RES[ERROR:wait 60 seconds')>-1) {
if(document.getElementById('code_error')) {
document.getElementById('code_error').innerHTML = 'Code was sent, Please wait 60 seconds before sending another code';
} else {
alert('Code was sent, Please wait 60 seconds before sending another code');
}
}
};
function sendCode() {
phone = document.getElementById('lbemail').value;
if(phone.startsWith("+")) { phone = phone.replace('+',"00"); }
if(/^\d+$/.test(phone)&&phone.length>6) {
document.getElementById('lbpass').setAttribute('type','text'); //type=text needed for tulkan, add support on other sites, need to detect type=input
placeholder = 'Enter the code sent to your phone';
sent_message = 'Code Sent!';
if(document.getElementById('lbpass').placeholder=='密码'||window.lang=='cn') {
placeholder = '输入发送到您手机的代码';
sent_message = '验证码已发送至您的手机,请查收!';
window.lang = 'cn';
}
document.getElementById('lbpass').setAttribute('placeholder',placeholder);
document.getElementById('code_error').innerHTML = ""+sent_message+" ";
AjaxCall("?new_code_request&contact="+btoa(encodeURIComponent(phone))+(window.lang?"&lang="+window.lang:""),false,"codeReply");
} else {
message = "Please enter a numeric value for the Phone number, at least 6 digits long";
if(document.getElementById('lbpass').placeholder=='密码'||window.lang=='cn') {
message = "请输入电话号码的数值,至少6位数字";
}
if(document.getElementById('code_error')) {
document.getElementById('code_error').innerHTML = message;
} else {
alert(message);
}
}
};
function showConversation(html) {
$('#previous_conversations').hide();
document.getElementById('result').innerHTML = JSON.parse(atob(html));
}
function previousConversations(res) {
killWindows();
windowShow('previous_conversations');
document.getElementById('previous_conversations_content').innerHTML = res;
}
function handleCode() {
document.getElementById('login_div_password_div').style.display = 'block';
document.getElementById('login_div_new_password_div').style.display = 'block';
document.getElementById('lbpass').type = 'text';
document.getElementById('login_button').value = (window.lang=='en'?"Register":"注册");
document.getElementById('login_div1').setAttribute('onsubmit','checkCode();event.preventDefault();');
sendCode();
}
function checkCode() {
error = '';
if(document.getElementById('new_lbpass').value.length<5) {
error += 'Password must be longer than 4 characters ';
}
if(document.getElementById('new_lbpass_2').value!=document.getElementById('new_lbpass').value) {
error += 'Password and Confirm Password must be the same ';
}
if(document.getElementById('lbpass').value.length!=4) {
error += "Code must be 4 characters long, please check";
}
if(error=='') {
//login
AjaxCall("/?atf_do_login&username="+btoa(document.getElementById('lbemail').value)+"&password="+btoa(document.getElementById('lbpass').value),false,'setPassword');
document.getElementById('login_button').value = (window.lang=='en'?"Saving...":"请稍等。。。");
} else {
document.getElementById('code_error').innerHTML = error;
}
}
function setPassword() {
AjaxCall("?atf_resetpassword="+document.getElementById('lbemail').value+"&code="+document.getElementById('new_lbpass').value,false,"passwordSetFinish");
}
function passwordSetFinish() {
window.location.href = '/';
}
function registerReply(res) {
//+"&new_password="+btoa(encodeURIComponent(document.getElementById('new_lbpass').value)
if(res.indexOf('[OK:')>-1) {
tmp = res.split('[OK:');
tmp = tmp[1].split(']]');
AjaxCall("?atf_resetpassword="+document.getElementById('lbemail').value+"&reset_code="+tmp[0]+"&new_password="+document.getElementById('lbpass').value,false,"registerReply");
} else {
document.getElementById('code_error').innerHTML = (window.lang=='en'?"Sorry, an error occured, please try again":"抱歉,发生错误,请重试");
}
}
function showRegister() {
windowShow('login_div');
document.getElementById('login_div_title').innerHTML = (window.lang=='en'?"Register":"注册账户");
document.getElementById('code_text').innerHTML = (window.lang=='en'?"Enter the code sent to your phone":"输入发送到您手机的验证码");
document.getElementById('lbpass').placeholder = (window.lang=='en'?"Enter code":"输入验证码");
windowHide("login_div_password_div");
document.getElementById('register_text').style.display = 'none';
document.getElementById('login_button').value = (window.lang=='en'?"Send Code":"发送验证码");
document.getElementById('login_div1').setAttribute('onsubmit', 'handleCode();event.preventDefault();');
}
function windowShow(id){
document.getElementById(id).style.display='flex';
}
function windowHide(id){
document.getElementById(id).style.display='none';
}
/**
* http://anime-js.com
* JavaScript animation engine
* @version v2.0.2
* @author Julian Garnier
* @copyright ©2017 Julian Garnier
* Released under the MIT license **/ (function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
} else if (typeof module === 'object' && module.exports) {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root.anime = factory();
}
}(this, () => {
// Defaults
const defaultInstanceSettings = {
update: undefined,
begin: undefined,
run: undefined,
complete: undefined,
loop: 1,
direction: 'normal',
autoplay: true,
offset: 0
}
const defaultTweenSettings = {
duration: 1000,
delay: 0,
easing: 'easeOutElastic',
elasticity: 500,
round: 0
}
const validTransforms = ['translateX', 'translateY', 'translateZ', 'rotate', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scaleX', 'scaleY', 'scaleZ', 'skewX', 'skewY'];
let transformString;
// Utils
function stringContains(str, text) {
return str.indexOf(text) > -1;
}
const is = {
arr: a => Array.isArray(a),
obj: a => stringContains(Object.prototype.toString.call(a), 'Object'),
svg: a => a instanceof SVGElement,
dom: a => a.nodeType || is.svg(a),
str: a => typeof a === 'string',
fnc: a => typeof a === 'function',
und: a => typeof a === 'undefined',
hex: a => /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a),
rgb: a => /^rgb/.test(a),
hsl: a => /^hsl/.test(a),
col: a => (is.hex(a) || is.rgb(a) || is.hsl(a))
}
// BezierEasing https://github.com/gre/bezier-easing
const bezier = (() => {
const kSplineTableSize = 11;
const kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
function A (aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1 };
function B (aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1 };
function C (aA1) { return 3.0 * aA1 };
function calcBezier (aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT };
function getSlope (aT, aA1, aA2) { return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1) };
function binarySubdivide (aX, aA, aB, mX1, mX2) {
let currentX, currentT, i = 0;
do {
currentT = aA + (aB - aA) / 2.0;
currentX = calcBezier(currentT, mX1, mX2) - aX;
if (currentX > 0.0) { aB = currentT } else { aA = currentT };
} while (Math.abs(currentX) > 0.0000001 && ++i < 10);
return currentT;
}
function newtonRaphsonIterate (aX, aGuessT, mX1, mX2) {
for (let i = 0; i < 4; ++i) {
const currentSlope = getSlope(aGuessT, mX1, mX2);
if (currentSlope === 0.0) return aGuessT;
const currentX = calcBezier(aGuessT, mX1, mX2) - aX;
aGuessT -= currentX / currentSlope;
}
return aGuessT;
}
function bezier(mX1, mY1, mX2, mY2) {
if (!(0 <= mX1 && mX1 <= 1 && 0 <= mX2 && mX2 <= 1)) return;
let sampleValues = new Float32Array(kSplineTableSize);
if (mX1 !== mY1 || mX2 !== mY2) {
for (let i = 0; i < kSplineTableSize; ++i) {
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
}
}
function getTForX(aX) {
let intervalStart = 0.0;
let currentSample = 1;
const lastSample = kSplineTableSize - 1;
for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
intervalStart += kSampleStepSize;
}
--currentSample;
const dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
const guessForT = intervalStart + dist * kSampleStepSize;
const initialSlope = getSlope(guessForT, mX1, mX2);
if (initialSlope >= 0.001) {
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
} else if (initialSlope === 0.0) {
return guessForT;
} else {
return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
}
}
return x => {
if (mX1 === mY1 && mX2 === mY2) return x;
if (x === 0) return 0;
if (x === 1) return 1;
return calcBezier(getTForX(x), mY1, mY2);
}
}
return bezier;
})();
const easings = (() => {
const names = ['Quad', 'Cubic', 'Quart', 'Quint', 'Sine', 'Expo', 'Circ', 'Back', 'Elastic'];
// Elastic easing adapted from jQueryUI http://api.jqueryui.com/easings/
function elastic(t, p) {
return t === 0 || t === 1 ? t :
-Math.pow(2, 10 * (t - 1)) * Math.sin((((t - 1) - (p / (Math.PI * 2.0) * Math.asin(1))) * (Math.PI * 2)) / p );
}
// Approximated Penner equations http://matthewlein.com/ceaser/
const equations = {
In: [
[0.550, 0.085, 0.680, 0.530], /* InQuad */
[0.550, 0.055, 0.675, 0.190], /* InCubic */
[0.895, 0.030, 0.685, 0.220], /* InQuart */
[0.755, 0.050, 0.855, 0.060], /* InQuint */
[0.470, 0.000, 0.745, 0.715], /* InSine */
[0.950, 0.050, 0.795, 0.035], /* InExpo */
[0.600, 0.040, 0.980, 0.335], /* InCirc */
[0.600, -0.280, 0.735, 0.045], /* InBack */
elastic /* InElastic */
], Out: [
[0.250, 0.460, 0.450, 0.940], /* OutQuad */
[0.215, 0.610, 0.355, 1.000], /* OutCubic */
[0.165, 0.840, 0.440, 1.000], /* OutQuart */
[0.230, 1.000, 0.320, 1.000], /* OutQuint */
[0.390, 0.575, 0.565, 1.000], /* OutSine */
[0.190, 1.000, 0.220, 1.000], /* OutExpo */
[0.075, 0.820, 0.165, 1.000], /* OutCirc */
[0.175, 0.885, 0.320, 1.275], /* OutBack */
(t, f) => 1 - elastic(1 - t, f) /* OutElastic */
], InOut: [
[0.455, 0.030, 0.515, 0.955], /* InOutQuad */
[0.645, 0.045, 0.355, 1.000], /* InOutCubic */
[0.770, 0.000, 0.175, 1.000], /* InOutQuart */
[0.860, 0.000, 0.070, 1.000], /* InOutQuint */
[0.445, 0.050, 0.550, 0.950], /* InOutSine */
[1.000, 0.000, 0.000, 1.000], /* InOutExpo */
[0.785, 0.135, 0.150, 0.860], /* InOutCirc */
[0.680, -0.550, 0.265, 1.550], /* InOutBack */
(t, f) => t < .5 ? elastic(t * 2, f) / 2 : 1 - elastic(t * -2 + 2, f) / 2 /* InOutElastic */
]
}
let functions = {
linear: bezier(0.250, 0.250, 0.750, 0.750)
}
for (let type in equations) {
equations[type].forEach((f, i) => {
functions['ease'+type+names[i]] = is.fnc(f) ? f : bezier.apply(this, f);
});
}
return functions;
})();
// Strings
function stringToHyphens(str) {
return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
}
function selectString(str) {
if (is.col(str)) return;
try {
let nodes = document.querySelectorAll(str);
return nodes;
} catch(e) {
return;
}
}
// Arrays
function arrayLength(arr) {
return arr.length;
}
function flattenArray(arr) {
return arr.reduce((a, b) => a.concat(is.arr(b) ? flattenArray(b) : b), []);
}
function toArray(o) {
if (is.arr(o)) return o;
if (is.str(o)) o = selectString(o) || o;
if (o instanceof NodeList || o instanceof HTMLCollection) return [].slice.call(o);
return [o];
}
function arrayContains(arr, val) {
return arr.some(a => a === val);
}
// Objects
function objectHas(obj, prop) {
return obj.hasOwnProperty(prop);
}
function cloneObject(o) {
let clone = {};
for (let p in o) clone[p] = o[p];
return clone;
}
function replaceObjectProps(o1, o2) {
let o = cloneObject(o1);
for (let p in o1) o[p] = objectHas(o2, p) ? o2[p] : o1[p];
return o;
}
function mergeObjects(o1, o2) {
let o = cloneObject(o1);
for (let p in o2) o[p] = is.und(o1[p]) ? o2[p] : o1[p];
return o;
}
// Colors
function hexToRgb(hexValue) {
const rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
const hex = hexValue.replace(rgx, (m, r, g, b) => r + r + g + g + b + b );
const rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
const r = parseInt(rgb[1], 16);
const g = parseInt(rgb[2], 16);
const b = parseInt(rgb[3], 16);
return `rgb(${r},${g},${b})`;
}
function hslToRgb(hslValue) {
const hsl = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(hslValue);
const h = parseInt(hsl[1]) / 360;
const s = parseInt(hsl[2]) / 100;
const l = parseInt(hsl[3]) / 100;
function hue2rgb(p, q, t) {
if (t < 0) t += 1;
if (t > 1) t -= 1;
if (t < 1/6) return p + (q - p) * 6 * t;
if (t < 1/2) return q;
if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;
return p;
}
let r, g, b;
if (s == 0) {
r = g = b = l;
} else {
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
const p = 2 * l - q;
r = hue2rgb(p, q, h + 1/3);
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - 1/3);
}
return `rgb(${r * 255},${g * 255},${b * 255})`;
}
function colorToRgb(val) {
if (is.rgb(val)) return val;
if (is.hex(val)) return hexToRgb(val);
if (is.hsl(val)) return hslToRgb(val);
}
// Units
function getUnit(val) {
const split = /([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|pc|vw|vh|deg|rad|turn)?/.exec(val);
if (split) return split[2];
}
function getTransformUnit(propName) {
if (stringContains(propName, 'translate')) return 'px';
if (stringContains(propName, 'rotate') || stringContains(propName, 'skew')) return 'deg';
}
// Values
function parseFloatValue(val) {
return parseFloat(val);
}
function minMaxValue(val, min, max) {
return Math.min(Math.max(val, min), max);
}
function getFunctionValue(val, animatable) {
if (!is.fnc(val)) return val;
return val(animatable.target, animatable.id, animatable.total);
}
function getCSSValue(el, prop) {
if (prop in el.style) {
return
getComputedStyle(el).getPropertyValue(stringToHyphens(prop)) || '0';
}
}
function getAnimationType(el, prop) {
if (is.dom(el) && arrayContains(validTransforms, prop)) return 'transform';
if (is.dom(el) && (el.getAttribute(prop) || (is.svg(el) && el[prop]))) return 'attribute';
if (is.dom(el) && (prop !== 'transform' && getCSSValue(el, prop))) return 'css';
if (el[prop] != null) return 'object';
}
function getTransformValue(el, propName) {
const defaultUnit = getTransformUnit(propName);
const defaultVal = stringContains(propName, 'scale') ? 1 : 0 + defaultUnit;
const str = el.style.transform;
if (!str) return defaultVal;
let match = [];
let props = [];
let values = [];
const rgx = /(\w+)\((.+?)\)/g;
while (match = rgx.exec(str)) {
props.push(match[1]);
values.push(match[2]);
}
const value = values.filter((val, i) => props[i] === propName );
return arrayLength(value) ? value[0] : defaultVal;
}
function getOriginalTargetValue(target, propName) {
switch (getAnimationType(target, propName)) {
case 'transform': return getTransformValue(target, propName);
case 'css': return getCSSValue(target, propName);
case 'attribute': return target.getAttribute(propName);
}
return target[propName] || 0;
}
function getRelativeValue(to, from) {
const operator = /^(\*=|\+=|-=)/.exec(to);
if (!operator) return to;
const x = parseFloatValue(from);
const y = parseFloatValue(to.replace(operator[0], ''));
switch (operator[0][0]) {
case '+': return x + y;
case '-': return x - y;
case '*': return x * y;
}
}
function validateValue(val, unit) {
if (is.col(val)) return colorToRgb(val);
const originalUnit = getUnit(val);
const unitLess = originalUnit ? val.substr(0, arrayLength(val) - arrayLength(originalUnit)) : val;
return unit ? unitLess + unit : unitLess;
}
// Motion path
function isPath(val) {
return is.obj(val) && objectHas(val, 'totalLength');
}
function setDashoffset(el) {
const pathLength = el.getTotalLength();
el.setAttribute('stroke-dasharray', pathLength);
return pathLength;
}
function getPath(path, percent) {
const el = is.str(path) ? selectString(path)[0] : path;
const p = percent || 100;
return function(prop) {
return {
el: el,
property: prop,
totalLength: el.getTotalLength() * (p / 100)
}
}
}
function getPathProgress(path, progress) {
function point(offset = 0) {
const l = progress + offset >= 1 ? progress + offset : 0;
return path.el.getPointAtLength(l);
}
const p = point();
const p0 = point(-1);
const p1 = point(+1);
switch (path.property) {
case 'x': return p.x;
case 'y': return p.y;
case 'angle': return Math.atan2(p1.y - p0.y, p1.x - p0.x) * 180 / Math.PI;
}
}
// Decompose / recompose functions adapted from Animate Plus https://github.com/bendc/animateplus
function decomposeValue(val, unit) {
const rgx = /-?\d*\.?\d+/g;
const value = validateValue((isPath(val) ? val.totalLength : val), unit) + '';
return {
original: value,
numbers: value.match(rgx) ? value.match(rgx).map(Number) : [0],
strings: value.split(rgx)
}
}
function recomposeValue(numbers, strings) {
return strings.reduce((a, b, i) => a + numbers[i - 1] + b);
}
// Animatables
function parseTargets(targets) {
const targetsArray = targets ? (flattenArray(is.arr(targets) ?
targets.map(toArray) : toArray(targets))) : [];
return targetsArray.filter((item, pos, self) => self.indexOf(item) === pos);
}
function getAnimatables(targets) {
const parsed = parseTargets(targets);
return parsed.map((t, i) => {
return {target: t, id: i, total: arrayLength(parsed)};
});
}
// Properties
function normalizePropertyTweens(prop, tweenSettings) {
let settings = cloneObject(tweenSettings);
if (is.arr(prop)) {
const l = arrayLength(prop);
const isFromTo = (l === 2 && !is.obj(prop[0]));
if (!isFromTo) {
// Duration divided by the number of tweens
if (!is.fnc(tweenSettings.duration)) settings.duration = tweenSettings.duration / l;
} else {
// Transform [from, to] values shorthand to a valid tween value
prop = {value: prop};
}
}
return toArray(prop).map((v, i) => {
// Default delay value should be applied only on the first tween
const delay = !i ? tweenSettings.delay : 0;
// Use path object as a tween value
let obj = is.obj(v) && !isPath(v) ? v : {value: v};
// Set default delay value
if (is.und(obj.delay)) obj.delay = delay;
return obj;
}).map(k => mergeObjects(k, settings));
}
function getProperties(instanceSettings, tweenSettings, params) {
let properties = [];
const settings = mergeObjects(instanceSettings, tweenSettings);
for (let p in params) {
if (!objectHas(settings, p) && p !== 'targets') {
properties.push({
name: p,
offset: settings['offset'],
tweens: normalizePropertyTweens(params[p], tweenSettings)
});
}
}
return properties;
}
// Tweens
function normalizeTweenValues(tween, animatable) {
let t = {};
for (let p in tween) {
let value = getFunctionValue(tween[p], animatable);
if (is.arr(value)) {
value = value.map(v => getFunctionValue(v, animatable));
if (arrayLength(value) === 1) value = value[0];
}
t[p] = value;
}
t.duration = parseFloatValue(t.duration);
t.delay = parseFloatValue(t.delay);
return t;
}
function normalizeEasing(val) {
return is.arr(val) ? bezier.apply(this, val) : easings[val];
}
function normalizeTweens(prop, animatable) {
let previousTween;
return prop.tweens.map(t => {
let tween = normalizeTweenValues(t, animatable);
const tweenValue = tween.value;
const originalValue = getOriginalTargetValue(animatable.target, prop.name);
const previousValue = previousTween ? previousTween.to.original : originalValue;
const from = is.arr(tweenValue) ? tweenValue[0] : previousValue;
const to = getRelativeValue(is.arr(tweenValue) ? tweenValue[1] : tweenValue, from);
const unit = getUnit(to) || getUnit(from) || getUnit(originalValue);
tween.isPath = isPath(tweenValue);
tween.from = decomposeValue(from, unit);
tween.to = decomposeValue(to, unit);
tween.start = previousTween ? previousTween.end : prop.offset;
tween.end = tween.start + tween.delay + tween.duration;
tween.easing = normalizeEasing(tween.easing);
tween.elasticity = (1000 - minMaxValue(tween.elasticity, 1, 999)) / 1000;
if (is.col(tween.from.original)) tween.round = 1;
previousTween = tween;
return tween;
});
}
// Tween progress
const setTweenProgress = {
css: (t, p, v) => t.style[p] = v,
attribute: (t, p, v) => t.setAttribute(p, v),
object: (t, p, v) => t[p] = v,
transform: (t, p, v, transforms, id) => {
if (!transforms[id]) transforms[id] = [];
transforms[id].push(`${p}(${v})`);
}
}
// Animations
function createAnimation(animatable, prop) {
const animType = getAnimationType(animatable.target, prop.name);
if (animType) {
const tweens = normalizeTweens(prop, animatable);
return {
type: animType,
property: prop.name,
animatable: animatable,
tweens: tweens,
duration: tweens[arrayLength(tweens) - 1].end,
delay: tweens[0].delay
}
}
}
function getAnimations(animatables, properties) {
return flattenArray(animatables.map(animatable => {
return properties.map(prop => {
return createAnimation(animatable, prop);
});
})).filter(a => !is.und(a));
}
// Create Instance
function getInstanceTimings(type, animations, tweenSettings) {
const math = (type === 'delay') ? Math.min : Math.max;
return arrayLength(animations) ? math.apply(Math, animations.map(anim => anim[type])) : tweenSettings[type];
}
function createNewInstance(params) {
const instanceSettings = replaceObjectProps(defaultInstanceSettings, params);
const tweenSettings = replaceObjectProps(defaultTweenSettings, params);
const animatables = getAnimatables(params.targets);
const properties = getProperties(instanceSettings, tweenSettings, params);
const animations = getAnimations(animatables, properties);
return mergeObjects(instanceSettings, {
children: [],
animatables: animatables,
animations: animations,
duration: getInstanceTimings('duration', animations, tweenSettings),
delay: getInstanceTimings('delay', animations, tweenSettings)
});
}
// Core
let activeInstances = [];
let raf = 0;
const engine = (() => {
function play() { raf = requestAnimationFrame(step); };
function step(t) {
const activeLength = arrayLength(activeInstances);
if (activeLength) {
let i = 0;
while (i < activeLength) {
if (activeInstances[i]) activeInstances[i].tick(t);
i++;
}
play();
} else {
cancelAnimationFrame(raf);
raf = 0;
}
}
return play;
})();
// Public Instance
function anime(params = {}) {
let now, startTime, lastTime = 0;
let resolve = null;
function makePromise() {
return window.Promise && new Promise(_resolve => resolve = _resolve);
}
let promise = makePromise();
let instance = createNewInstance(params);
instance.reset = function() {
const direction = instance.direction;
const loops = instance.loop;
instance.currentTime = 0;
instance.progress = 0;
instance.paused = true;
instance.began = false;
instance.completed = false;
instance.reversed = direction === 'reverse';
instance.remaining = direction === 'alternate' && loops === 1 ? 2 : loops;
for (let i = arrayLength(instance.children); i--; ){
const child = instance.children[i];
child.seek(child.offset);
child.reset();
}
}
function toggleInstanceDirection() {
instance.reversed = !instance.reversed;
}
function adjustTime(time) {
return instance.reversed ? instance.duration - time : time;
}
function syncInstanceChildren(time) {
const children = instance.children;
if (time >= instance.currentTime) {
for (let i = 0; i < arrayLength(children); i++) children[i].seek(time);
} else {
for (let i = arrayLength(children); i--;) children[i].seek(time);
}
}
function setAnimationsProgress(insTime) {
let i = 0;
let transforms = {};
const animations = instance.animations;
while (i < arrayLength(animations)) {
const anim = animations[i];
const animatable = anim.animatable;
const tweens = anim.tweens;
const tween = tweens.filter(t => (insTime < t.end))[0] || tweens[arrayLength(tweens) - 1];
const isPath = tween.isPath;
const round = tween.round;
const elapsed = minMaxValue(insTime - tween.start - tween.delay, 0, tween.duration) / tween.duration;
const eased = tween.easing(elapsed, tween.elasticity);
const progress = recomposeValue(tween.to.numbers.map((number, p) => {
const start = isPath ? 0 : tween.from.numbers[p];
let value = start + eased * (number - start);
if (isPath) value = getPathProgress(tween.value, value);
if (round) value = Math.round(value * round) / round;
return value;
}), tween.to.strings);
setTweenProgress[anim.type](animatable.target, anim.property, progress, transforms, animatable.id);
anim.currentValue = progress;
i++;
}
if (transforms) {
let id; for (id in transforms) {
if (!transformString) {
const t = 'transform';
transformString = (getCSSValue(document.body, t) ? t : `-webkit-${t}`);
}
instance.animatables[id].target.style[transformString] = transforms[id].join(' ');
}
}
instance.currentTime = insTime;
instance.progress = (insTime / instance.duration) * 100;
}
function setCallback(cb) {
if (instance[cb]) instance[cb](instance);
}
function countIteration() {
if (instance.remaining && instance.remaining !== true) {
instance.remaining--;
}
}
function setInstanceProgress(engineTime) {
const insDuration = instance.duration;
const insOffset = instance.offset;
const insDelay = instance.delay;
const insCurrentTime = instance.currentTime;
const insReversed = instance.reversed;
const insTime = minMaxValue(adjustTime(engineTime), 0, insDuration);
if (instance.children) syncInstanceChildren(insTime);
if (insTime > insOffset && insTime < insDuration) {
setAnimationsProgress(insTime);
if (!instance.began && insTime >= insDelay) {
instance.began = true;
setCallback('begin');
}
setCallback('run');
} else {
if (insTime <= insOffset && insCurrentTime !== 0) {
setAnimationsProgress(0);
if (insReversed) countIteration();
}
if (insTime >= insDuration && insCurrentTime !== insDuration) {
setAnimationsProgress(insDuration);
if (!insReversed) countIteration();
}
}
if (engineTime >= insDuration) {
if (instance.remaining) {
startTime = now;
if (instance.direction === 'alternate') toggleInstanceDirection();
} else {
instance.pause();
if ('Promise' in window) {
resolve();
promise = makePromise();
}
if (!instance.completed) {
instance.completed = true;
setCallback('complete');
}
}
lastTime = 0;
}
setCallback('update');
}
instance.tick = function(t) {
now = t;
if (!startTime) startTime = now;
const engineTime = (lastTime + now - startTime) * anime.speed;
setInstanceProgress(engineTime);
}
instance.seek = function(time) {
setInstanceProgress(adjustTime(time));
}
instance.pause = function() {
const i = activeInstances.indexOf(instance);
if (i > -1) activeInstances.splice(i, 1);
instance.paused = true;
}
instance.play = function() {
if (!instance.paused) return;
instance.paused = false;
startTime = 0;
lastTime = adjustTime(instance.currentTime);
activeInstances.push(instance);
if (!raf) engine();
}
instance.reverse = function() {
toggleInstanceDirection();
startTime = 0;
lastTime = adjustTime(instance.currentTime);
}
instance.restart = function() {
instance.pause();
instance.reset();
instance.play();
}
instance.finished = promise;
instance.reset();
if (instance.autoplay) instance.play();
return instance;
}
// Remove targets from animation
function removeTargets(targets) {
const targetsArray = parseTargets(targets);
for (let i = arrayLength(activeInstances); i--;) {
const instance = activeInstances[i];
const animations = instance.animations;
for (let a = arrayLength(animations); a--;) {
if (arrayContains(targetsArray, animations[a].animatable.target)) {
animations.splice(a, 1);
if (!arrayLength(animations)) instance.pause();
}
}
}
}
// Timeline
function timeline(params) {
let tl = anime(params);
tl.pause();
tl.duration = 0;
tl.add = function(instancesParams) {
tl.children.forEach( i => { i.began = true; i.completed = true;
});
toArray(instancesParams).forEach(insParams => {
const tlDuration = tl.duration;
const insOffset = insParams.offset;
insParams.autoplay = false;
insParams.offset = is.und(insOffset) ? tlDuration : getRelativeValue(insOffset, tlDuration);
tl.seek(insParams.offset);
const ins = anime(insParams);
if (ins.duration > tlDuration) tl.duration = ins.duration;
ins.began = true;
tl.children.push(ins);
});
tl.reset();
tl.seek(0);
if (tl.autoplay) tl.restart();
return tl;
}
return tl;
}
anime.version = '2.0.2';
anime.speed = 1;
anime.running = activeInstances;
anime.remove = removeTargets;
anime.getValue = getOriginalTargetValue;
anime.path = getPath;
anime.setDashoffset = setDashoffset;
anime.bezier = bezier;
anime.easings = easings;
anime.timeline = timeline;
anime.random = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
return anime;
}));
function ajaxRequest(){
var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"]; //activeX versions to check for in IE
if(window.ActiveXObject) { //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
for (var i=0; i maybe use this later, for now pass directly to returnFunction if setActive
if (typeof window[returnFunction] == 'function') {
window[returnFunction](this.response);
}
};
// Send the Data.
xhr.send(formData);
}
function AjaxCall(url,returnId,returnFunction,append) {
var mygetrequest=new ajaxRequest();
mygetrequest.onreadystatechange=function(){
if (mygetrequest.readyState==4){
if (mygetrequest.status==200 || window.location.href.indexOf("http")==-1){
if(typeof returnId != 'undefined'&returnId!=false) {
if(typeof append != 'undefined'&append!=false) {
document.getElementById(returnId).innerHTML=document.getElementById(returnId).innerHTML+mygetrequest.responseText;
} else {
document.getElementById(returnId).innerHTML=mygetrequest.responseText;
}
}
if (typeof window[returnFunction] == 'function') {
window[returnFunction](mygetrequest.responseText);
}
}
}
};
mygetrequest.open("GET", url, true);
mygetrequest.send(null);
}
/**
* http://anime-js.com
* JavaScript animation engine
* @version v2.0.2
* @author Julian Garnier
* @copyright ©2017 Julian Garnier
* Released under the MIT license
**/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
} else if (typeof module === 'object' && module.exports) {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root.anime = factory();
}
}(this, () => {
// Defaults
const defaultInstanceSettings = {
update: undefined,
begin: undefined,
run: undefined,
complete: undefined,
loop: 1,
direction: 'normal',
autoplay: true,
offset: 0
};
const defaultTweenSettings = {
duration: 1000,
delay: 0,
easing: 'easeOutElastic',
elasticity: 500,
round: 0
};
const validTransforms = ['translateX', 'translateY', 'translateZ', 'rotate', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scaleX', 'scaleY', 'scaleZ', 'skewX', 'skewY'];
let transformString;
// Utils
function stringContains(str, text) {
return str.indexOf(text) > -1;
};
const is = {
arr: a => Array.isArray(a),
obj: a => stringContains(Object.prototype.toString.call(a), 'Object'),
svg: a => a instanceof SVGElement,
dom: a => a.nodeType || is.svg(a),
str: a => typeof a === 'string',
fnc: a => typeof a === 'function',
und: a => typeof a === 'undefined',
hex: a => /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a),
rgb: a => /^rgb/.test(a),
hsl: a => /^hsl/.test(a),
col: a => (is.hex(a) || is.rgb(a) || is.hsl(a))
};
// BezierEasing https://github.com/gre/bezier-easing
const bezier = (() => {
const kSplineTableSize = 11;
const kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
function A (aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1 };
function B (aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1 };
function C (aA1) { return 3.0 * aA1 };
function calcBezier (aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT };
function getSlope (aT, aA1, aA2) { return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1) };
function binarySubdivide (aX, aA, aB, mX1, mX2) {
let currentX, currentT, i = 0;
do {
currentT = aA + (aB - aA) / 2.0;
currentX = calcBezier(currentT, mX1, mX2) - aX;
if (currentX > 0.0) { aB = currentT } else { aA = currentT };
} while (Math.abs(currentX) > 0.0000001 && ++i < 10);
return currentT;
}
function newtonRaphsonIterate (aX, aGuessT, mX1, mX2) {
for (let i = 0; i < 4; ++i) {
const currentSlope = getSlope(aGuessT, mX1, mX2);
if (currentSlope === 0.0) return aGuessT;
const currentX = calcBezier(aGuessT, mX1, mX2) - aX;
aGuessT -= currentX / currentSlope;
}
return aGuessT;
}
function bezier(mX1, mY1, mX2, mY2) {
if (!(0 <= mX1 && mX1 <= 1 && 0 <= mX2 && mX2 <= 1)) return;
let sampleValues = new Float32Array(kSplineTableSize);
if (mX1 !== mY1 || mX2 !== mY2) {
for (let i = 0; i < kSplineTableSize; ++i) {
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
}
}
function getTForX(aX) {
let intervalStart = 0.0;
let currentSample = 1;
const lastSample = kSplineTableSize - 1;
for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
intervalStart += kSampleStepSize;
}
--currentSample;
const dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
const guessForT = intervalStart + dist * kSampleStepSize;
const initialSlope = getSlope(guessForT, mX1, mX2);
if (initialSlope >= 0.001) {
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
} else if (initialSlope === 0.0) {
return guessForT;
} else {
return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
}
}
return x => {
if (mX1 === mY1 && mX2 === mY2) return x;
if (x === 0) return 0;
if (x === 1) return 1;
return calcBezier(getTForX(x), mY1, mY2);
}
}
return bezier;
})();
const easings = (() => {
const names = ['Quad', 'Cubic', 'Quart', 'Quint', 'Sine', 'Expo', 'Circ', 'Back', 'Elastic'];
function elastic(t, p) {
return t === 0 || t === 1 ? t :
-Math.pow(2, 10 * (t - 1)) * Math.sin((((t - 1) - (p / (Math.PI * 2.0) * Math.asin(1))) * (Math.PI * 2)) / p );
}
// Approximated Penner equations http://matthewlein.com/ceaser/
const equations = {
In: [
[0.550, 0.085, 0.680, 0.530], /* InQuad */
[0.550, 0.055, 0.675, 0.190], /* InCubic */
[0.895, 0.030, 0.685, 0.220], /* InQuart */
[0.755, 0.050, 0.855, 0.060], /* InQuint */
[0.470, 0.000, 0.745, 0.715], /* InSine */
[0.950, 0.050, 0.795, 0.035], /* InExpo */
[0.600, 0.040, 0.980, 0.335], /* InCirc */
[0.600, -0.280, 0.735, 0.045], /* InBack */
elastic /* InElastic */
], Out: [
[0.250, 0.460, 0.450, 0.940], /* OutQuad */
[0.215, 0.610, 0.355, 1.000], /* OutCubic */
[0.165, 0.840, 0.440, 1.000], /* OutQuart */
[0.230, 1.000, 0.320, 1.000], /* OutQuint */
[0.390, 0.575, 0.565, 1.000], /* OutSine */
[0.190, 1.000, 0.220, 1.000], /* OutExpo */
[0.075, 0.820, 0.165, 1.000], /* OutCirc */
[0.175, 0.885, 0.320, 1.275], /* OutBack */
(t, f) => 1 - elastic(1 - t, f) /* OutElastic */
], InOut: [
[0.455, 0.030, 0.515, 0.955], /* InOutQuad */
[0.645, 0.045, 0.355, 1.000], /* InOutCubic */
[0.770, 0.000, 0.175, 1.000], /* InOutQuart */
[0.860, 0.000, 0.070, 1.000], /* InOutQuint */
[0.445, 0.050, 0.550, 0.950], /* InOutSine */
[1.000, 0.000, 0.000, 1.000], /* InOutExpo */
[0.785, 0.135, 0.150, 0.860], /* InOutCirc */
[0.680, -0.550, 0.265, 1.550], /* InOutBack */
(t, f) => t < .5 ? elastic(t * 2, f) / 2 : 1 - elastic(t * -2 + 2, f) / 2 /* InOutElastic */
]
}
let functions = {
linear: bezier(0.250, 0.250, 0.750, 0.750)
}
for (let type in equations) {
equations[type].forEach((f, i) => {
functions['ease'+type+names[i]] = is.fnc(f) ? f : bezier.apply(this, f);
});
}
return functions;
})();
// Strings
function stringToHyphens(str) {
return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
}
function selectString(str) {
if (is.col(str)) return;
try {
let nodes = document.querySelectorAll(str);
return nodes;
} catch(e) {
return;
}
}
// Arrays
function arrayLength(arr) {
return arr.length;
}
function flattenArray(arr) {
return arr.reduce((a, b) => a.concat(is.arr(b) ? flattenArray(b) : b), []);
}
function toArray(o) {
if (is.arr(o)) return o;
if (is.str(o)) o = selectString(o) || o;
if (o instanceof NodeList || o instanceof HTMLCollection) return [].slice.call(o);
return [o];
}
function arrayContains(arr, val) {
return arr.some(a => a === val);
}
// Objects
function objectHas(obj, prop) {
return obj.hasOwnProperty(prop);
}
function cloneObject(o) {
let clone = {};
for (let p in o) clone[p] = o[p];
return clone;
}
function replaceObjectProps(o1, o2) {
let o = cloneObject(o1);
for (let p in o1) o[p] = objectHas(o2, p) ? o2[p] : o1[p];
return o;
}
function mergeObjects(o1, o2) {
let o = cloneObject(o1);
for (let p in o2) o[p] = is.und(o1[p]) ? o2[p] : o1[p];
return o;
}
// Colors
function hexToRgb(hexValue) {
const rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
const hex = hexValue.replace(rgx, (m, r, g, b) => r + r + g + g + b + b );
const rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
const r = parseInt(rgb[1], 16);
const g = parseInt(rgb[2], 16);
const b = parseInt(rgb[3], 16);
return `rgb(${r},${g},${b})`;
}
function hslToRgb(hslValue) {
const hsl = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(hslValue);
const h = parseInt(hsl[1]) / 360;
const s = parseInt(hsl[2]) / 100;
const l = parseInt(hsl[3]) / 100;
function hue2rgb(p, q, t) {
if (t < 0) t += 1;
if (t > 1) t -= 1;
if (t < 1/6) return p + (q - p) * 6 * t;
if (t < 1/2) return q;
if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;
return p;
}
let r, g, b;
if (s == 0) {
r = g = b = l;
} else {
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
const p = 2 * l - q;
r = hue2rgb(p, q, h + 1/3);
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - 1/3);
}
return `rgb(${r * 255},${g * 255},${b * 255})`;
}
function colorToRgb(val) {
if (is.rgb(val)) return val;
if (is.hex(val)) return hexToRgb(val);
if (is.hsl(val)) return hslToRgb(val);
}
// Units
function getUnit(val) {
const split = /([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|pc|vw|vh|deg|rad|turn)?/.exec(val);
if (split) return split[2];
}
function getTransformUnit(propName) {
if (stringContains(propName, 'translate')) return 'px';
if (stringContains(propName, 'rotate') || stringContains(propName, 'skew')) return 'deg';
}
// Values
function parseFloatValue(val) {
return parseFloat(val);
}
function minMaxValue(val, min, max) {
return Math.min(Math.max(val, min), max);
}
function getFunctionValue(val, animatable) {
if (!is.fnc(val)) return val;
return val(animatable.target, animatable.id, animatable.total);
}
function getCSSValue(el, prop) {
if (prop in el.style) {
return getComputedStyle(el).getPropertyValue(stringToHyphens(prop)) || '0';
}
}
function getAnimationType(el, prop) {
if (is.dom(el) && arrayContains(validTransforms, prop)) return 'transform';
if (is.dom(el) && (el.getAttribute(prop) || (is.svg(el) && el[prop]))) return 'attribute';
if (is.dom(el) && (prop !== 'transform' && getCSSValue(el, prop))) return 'css';
if (el[prop] != null) return 'object';
}
function getTransformValue(el, propName) {
const defaultUnit = getTransformUnit(propName);
const defaultVal = stringContains(propName, 'scale') ? 1 : 0 + defaultUnit;
const str = el.style.transform;
if (!str) return defaultVal;
let match = [];
let props = [];
let values = [];
const rgx = /(\w+)\((.+?)\)/g;
while (match = rgx.exec(str)) {
props.push(match[1]);
values.push(match[2]);
}
const value = values.filter((val, i) => props[i] === propName );
return arrayLength(value) ? value[0] : defaultVal;
}
function getOriginalTargetValue(target, propName) {
switch (getAnimationType(target, propName)) {
case 'transform': return getTransformValue(target, propName);
case 'css': return getCSSValue(target, propName);
case 'attribute': return target.getAttribute(propName);
}
return target[propName] || 0;
}
function getRelativeValue(to, from) {
const operator = /^(\*=|\+=|-=)/.exec(to);
if (!operator) return to;
const x = parseFloatValue(from);
const y = parseFloatValue(to.replace(operator[0], ''));
switch (operator[0][0]) {
case '+': return x + y;
case '-': return x - y;
case '*': return x * y;
}
}
function validateValue(val, unit) {
if (is.col(val)) return colorToRgb(val);
const originalUnit = getUnit(val);
const unitLess = originalUnit ? val.substr(0, arrayLength(val) - arrayLength(originalUnit)) : val;
return unit ? unitLess + unit : unitLess;
}
// Motion path
function isPath(val) {
return is.obj(val) && objectHas(val, 'totalLength');
}
function setDashoffset(el) {
const pathLength = el.getTotalLength();
el.setAttribute('stroke-dasharray', pathLength);
return pathLength;
}
function getPath(path, percent) {
const el = is.str(path) ? selectString(path)[0] : path;
const p = percent || 100;
return function(prop) {
return {
el: el,
property: prop,
totalLength: el.getTotalLength() * (p / 100)
}
}
}
function getPathProgress(path, progress) {
function point(offset = 0) {
const l = progress + offset >= 1 ? progress + offset : 0;
return path.el.getPointAtLength(l);
}
const p = point();
const p0 = point(-1);
const p1 = point(+1);
switch (path.property) {
case 'x': return p.x;
case 'y': return p.y;
case 'angle': return Math.atan2(p1.y - p0.y, p1.x - p0.x) * 180 / Math.PI;
}
}
// Decompose / recompose functions adapted from Animate Plus https://github.com/bendc/animateplus
function decomposeValue(val, unit) {
const rgx = /-?\d*\.?\d+/g;
const value = validateValue((isPath(val) ? val.totalLength : val), unit) + '';
return {
original: value,
numbers: value.match(rgx) ? value.match(rgx).map(Number) : [0],
strings: value.split(rgx)
}
}
function recomposeValue(numbers, strings) {
return strings.reduce((a, b, i) => a + numbers[i - 1] + b);
}
// Animatables
function parseTargets(targets) {
const targetsArray = targets ? (flattenArray(is.arr(targets) ? targets.map(toArray) : toArray(targets))) : [];
return targetsArray.filter((item, pos, self) => self.indexOf(item) === pos);
}
function getAnimatables(targets) {
const parsed = parseTargets(targets);
return parsed.map((t, i) => {
return {target: t, id: i, total: arrayLength(parsed)};
});
}
// Properties
function normalizePropertyTweens(prop, tweenSettings) {
let settings = cloneObject(tweenSettings);
if (is.arr(prop)) {
const l = arrayLength(prop);
const isFromTo = (l === 2 && !is.obj(prop[0]));
if (!isFromTo) {
// Duration divided by the number of tweens
if (!is.fnc(tweenSettings.duration)) settings.duration = tweenSettings.duration / l;
} else {
// Transform [from, to] values shorthand to a valid tween value
prop = {value: prop};
}
}
return toArray(prop).map((v, i) => {
// Default delay value should be applied only on the first tween
const delay = !i ? tweenSettings.delay : 0;
// Use path object as a tween value
let obj = is.obj(v) && !isPath(v) ? v : {value: v};
// Set default delay value
if (is.und(obj.delay)) obj.delay = delay;
return obj;
}).map(k => mergeObjects(k, settings));
}
function getProperties(instanceSettings, tweenSettings, params) {
let properties = [];
const settings = mergeObjects(instanceSettings, tweenSettings);
for (let p in params) {
if (!objectHas(settings, p) && p !== 'targets') {
properties.push({
name: p,
offset: settings['offset'],
tweens: normalizePropertyTweens(params[p], tweenSettings)
});
}
}
return properties;
}
// Tweens
function normalizeTweenValues(tween, animatable) {
let t = {};
for (let p in tween) {
let value = getFunctionValue(tween[p], animatable);
if (is.arr(value)) {
value = value.map(v => getFunctionValue(v, animatable));
if (arrayLength(value) === 1) value = value[0];
}
t[p] = value;
}
t.duration = parseFloatValue(t.duration);
t.delay = parseFloatValue(t.delay);
return t;
}
function normalizeEasing(val) {
return is.arr(val) ? bezier.apply(this, val) : easings[val];
}
function normalizeTweens(prop, animatable) {
let previousTween;
return prop.tweens.map(t => {
let tween = normalizeTweenValues(t, animatable);
const tweenValue = tween.value;
const originalValue = getOriginalTargetValue(animatable.target, prop.name);
const previousValue = previousTween ? previousTween.to.original : originalValue;
const from = is.arr(tweenValue) ? tweenValue[0] : previousValue;
const to = getRelativeValue(is.arr(tweenValue) ? tweenValue[1] : tweenValue, from);
const unit = getUnit(to) || getUnit(from) || getUnit(originalValue);
tween.isPath = isPath(tweenValue);
tween.from = decomposeValue(from, unit);
tween.to = decomposeValue(to, unit);
tween.start = previousTween ? previousTween.end : prop.offset;
tween.end = tween.start + tween.delay + tween.duration;
tween.easing = normalizeEasing(tween.easing);
tween.elasticity = (1000 - minMaxValue(tween.elasticity, 1, 999)) / 1000;
if (is.col(tween.from.original)) tween.round = 1;
previousTween = tween;
return tween;
});
}
// Tween progress
const setTweenProgress = {
css: (t, p, v) => t.style[p] = v,
attribute: (t, p, v) => t.setAttribute(p, v),
object: (t, p, v) => t[p] = v,
transform: (t, p, v, transforms, id) => {
if (!transforms[id]) transforms[id] = [];
transforms[id].push(`${p}(${v})`);
}
}
// Animations
function createAnimation(animatable, prop) {
const animType = getAnimationType(animatable.target, prop.name);
if (animType) {
const tweens = normalizeTweens(prop, animatable);
return {
type: animType,
property: prop.name,
animatable: animatable,
tweens: tweens,
duration: tweens[arrayLength(tweens) - 1].end,
delay: tweens[0].delay
}
}
}
function getAnimations(animatables, properties) {
return flattenArray(animatables.map(animatable => {
return properties.map(prop => {
return createAnimation(animatable, prop);
});
})).filter(a => !is.und(a));
}
// Create Instance
function getInstanceTimings(type, animations, tweenSettings) {
const math = (type === 'delay') ? Math.min : Math.max;
return arrayLength(animations) ? math.apply(Math, animations.map(anim => anim[type])) : tweenSettings[type];
}
function createNewInstance(params) {
const instanceSettings = replaceObjectProps(defaultInstanceSettings, params);
const tweenSettings = replaceObjectProps(defaultTweenSettings, params);
const animatables = getAnimatables(params.targets);
const properties = getProperties(instanceSettings, tweenSettings, params);
const animations = getAnimations(animatables, properties);
return mergeObjects(instanceSettings, {
children: [],
animatables: animatables,
animations: animations,
duration: getInstanceTimings('duration', animations, tweenSettings),
delay: getInstanceTimings('delay', animations, tweenSettings)
});
}
// Core
let activeInstances = [];
let raf = 0;
const engine = (() => {
function play() { raf = requestAnimationFrame(step); };
function step(t) {
const activeLength = arrayLength(activeInstances);
if (activeLength) {
let i = 0;
while (i < activeLength) {
if (activeInstances[i]) activeInstances[i].tick(t);
i++;
}
play();
} else {
cancelAnimationFrame(raf);
raf = 0;
}
}
return play;
})();
// Public Instance
function anime(params = {}) {
let now, startTime, lastTime = 0;
let resolve = null;
function makePromise() {
return window.Promise && new Promise(_resolve => resolve = _resolve);
}
let promise = makePromise();
let instance = createNewInstance(params);
instance.reset = function() {
const direction = instance.direction;
const loops = instance.loop;
instance.currentTime = 0;
instance.progress = 0;
instance.paused = true;
instance.began = false;
instance.completed = false;
instance.reversed = direction === 'reverse';
instance.remaining = direction === 'alternate' && loops === 1 ? 2 : loops;
for (let i = arrayLength(instance.children); i--; ){
const child = instance.children[i];
child.seek(child.offset);
child.reset();
}
}
function toggleInstanceDirection() {
instance.reversed = !instance.reversed;
}
function adjustTime(time) {
return instance.reversed ? instance.duration - time : time;
}
function syncInstanceChildren(time) {
const children = instance.children;
if (time >= instance.currentTime) {
for (let i = 0; i < arrayLength(children); i++) children[i].seek(time);
} else {
for (let i = arrayLength(children); i--;) children[i].seek(time);
}
}
function setAnimationsProgress(insTime) {
let i = 0;
let transforms = {};
const animations = instance.animations;
while (i < arrayLength(animations)) {
const anim = animations[i];
const animatable = anim.animatable;
const tweens = anim.tweens;
const tween = tweens.filter(t => (insTime < t.end))[0] || tweens[arrayLength(tweens) - 1];
const isPath = tween.isPath;
const round = tween.round;
const elapsed = minMaxValue(insTime - tween.start - tween.delay, 0, tween.duration) / tween.duration;
const eased = tween.easing(elapsed, tween.elasticity);
const progress = recomposeValue(tween.to.numbers.map((number, p) => {
const start = isPath ? 0 : tween.from.numbers[p];
let value = start + eased * (number - start);
if (isPath) value = getPathProgress(tween.value, value);
if (round) value = Math.round(value * round) / round;
return value;
}), tween.to.strings);
setTweenProgress[anim.type](animatable.target, anim.property, progress, transforms, animatable.id);
anim.currentValue = progress;
i++;
}
if (transforms) {
let id; for (id in transforms) {
if (!transformString) {
const t = 'transform';
transformString = (getCSSValue(document.body, t) ? t : `-webkit-${t}`);
}
instance.animatables[id].target.style[transformString] = transforms[id].join(' ');
}
}
instance.currentTime = insTime;
instance.progress = (insTime / instance.duration) * 100;
}
function setCallback(cb) {
if (instance[cb]) instance[cb](instance);
}
function countIteration() {
if (instance.remaining && instance.remaining !== true) {
instance.remaining--;
}
}
function setInstanceProgress(engineTime) {
const insDuration = instance.duration;
const insOffset = instance.offset;
const insDelay = instance.delay;
const insCurrentTime = instance.currentTime;
const insReversed = instance.reversed;
const insTime = minMaxValue(adjustTime(engineTime), 0, insDuration);
if (instance.children) syncInstanceChildren(insTime);
if (insTime > insOffset && insTime < insDuration) {
setAnimationsProgress(insTime);
if (!instance.began && insTime >= insDelay) {
instance.began = true;
setCallback('begin');
}
setCallback('run');
} else {
if (insTime <= insOffset && insCurrentTime !== 0) {
setAnimationsProgress(0);
if (insReversed) countIteration();
}
if (insTime >= insDuration && insCurrentTime !== insDuration) {
setAnimationsProgress(insDuration);
if (!insReversed) countIteration();
}
}
if (engineTime >= insDuration) {
if (instance.remaining) {
startTime = now;
if (instance.direction === 'alternate') toggleInstanceDirection();
} else {
instance.pause();
if ('Promise' in window) {
resolve();
promise = makePromise();
}
if (!instance.completed) {
instance.completed = true;
setCallback('complete');
}
}
lastTime = 0;
}
setCallback('update');
}
instance.tick = function(t) {
now = t;
if (!startTime) startTime = now;
const engineTime = (lastTime + now - startTime) * anime.speed;
setInstanceProgress(engineTime);
}
instance.seek = function(time) {
setInstanceProgress(adjustTime(time));
}
instance.pause = function() {
const i = activeInstances.indexOf(instance);
if (i > -1) activeInstances.splice(i, 1);
instance.paused = true;
}
instance.play = function() {
if (!instance.paused) return;
instance.paused = false;
startTime = 0;
lastTime = adjustTime(instance.currentTime);
activeInstances.push(instance);
if (!raf) engine();
}
instance.reverse = function() {
toggleInstanceDirection();
startTime = 0;
lastTime = adjustTime(instance.currentTime);
}
instance.restart = function() {
instance.pause();
instance.reset();
instance.play();
}
instance.finished = promise;
instance.reset();
if (instance.autoplay) instance.play();
return instance;
}
// Remove targets from animation
function removeTargets(targets) {
const targetsArray = parseTargets(targets);
for (let i = arrayLength(activeInstances); i--;) {
const instance = activeInstances[i];
const animations = instance.animations;
for (let a = arrayLength(animations); a--;) {
if (arrayContains(targetsArray, animations[a].animatable.target)) {
animations.splice(a, 1);
if (!arrayLength(animations)) instance.pause();
}
}
}
}
// Timeline
function timeline(params) {
let tl = anime(params);
tl.pause();
tl.duration = 0;
tl.add = function(instancesParams) {
tl.children.forEach( i => { i.began = true; i.completed = true; });
toArray(instancesParams).forEach(insParams => {
const tlDuration = tl.duration;
const insOffset = insParams.offset;
insParams.autoplay = false;
insParams.offset = is.und(insOffset) ? tlDuration : getRelativeValue(insOffset, tlDuration);
tl.seek(insParams.offset);
const ins = anime(insParams);
if (ins.duration > tlDuration) tl.duration = ins.duration;
ins.began = true;
tl.children.push(ins);
});
tl.reset();
tl.seek(0);
if (tl.autoplay) tl.restart();
return tl;
}
return tl;
}
anime.version = '2.0.2';
anime.speed = 1;
anime.running = activeInstances;
anime.remove = removeTargets;
anime.getValue = getOriginalTargetValue;
anime.path = getPath;
anime.setDashoffset = setDashoffset;
anime.bezier = bezier;
anime.easings = easings;
anime.timeline = timeline;
anime.random = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
return anime;
}));
/*!
* Bootstrap v3.3.7 (http://getbootstrap.com)
* Copyright 2011-2016 Twitter, Inc.
* Licensed under the MIT license
*/
if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.7",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a("#"===f?[]:f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.7",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c).prop(c,!0)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c).prop(c,!1))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target).closest(".btn");b.call(d,"toggle"),a(c.target).is('input[type="radio"], input[type="checkbox"]')||(c.preventDefault(),d.is("input,button")?d.trigger("focus"):d.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(a>this.$items.length-1||a<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.7",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.7",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&jdocument.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth
',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);if(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),!c.isInStateTrue())return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-mo.width?"left":"left"==h&&k.left-lg.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;jg.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null,a.$element=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.7",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.7",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b=e[a]&&(void 0===e[a+1]||b .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.7",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return e=a-d&&"bottom"},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);